Fix camera start.

This commit is contained in:
John Preston 2020-07-31 19:16:35 +04:00
parent 35dfb9fab3
commit aba8f72c36
2 changed files with 6 additions and 9 deletions

View File

@ -159,10 +159,11 @@ Call::Call(
if (_type == Type::Outgoing) {
setState(State::Requesting);
setupOutgoingVideo();
} else {
startWaitingTrack();
// setupOutgoingVideo will be called when we decide if it is enabled.
}
setupOutgoingVideo();
}
void Call::generateModExpFirst(bytes::const_span randomSeed) {
@ -337,9 +338,7 @@ void Call::setupOutgoingVideo() {
const auto started = _videoOutgoing->enabled();
_videoOutgoing->enabledValue(
) | rpl::start_with_next([=](bool enabled) {
if (_state.current() != State::Established
&& enabled != started
&& !(_type == Type::Incoming && !_id)) {
if (_state.current() != State::Established && enabled != started) {
_videoOutgoing->setEnabled(started);
} else if (enabled) {
if (!_videoCapture) {
@ -464,12 +463,10 @@ bool Call::handleUpdate(const MTPPhoneCall &call) {
return true;
}
// We are allowed to change it for non-established call
// only in case `incoming && !_id`, only when we just received it.
_videoOutgoing->setEnabled(data.is_video());
_id = data.vid().v;
_accessHash = data.vaccess_hash().v;
_videoOutgoing->setEnabled(data.is_video());
setupOutgoingVideo();
auto gaHashBytes = bytes::make_span(data.vg_a_hash().v);
if (gaHashBytes.size() != kSha256Size) {
LOG(("Call Error: Wrong g_a_hash size %1, expected %2."

@ -1 +1 @@
Subproject commit 78e8e4ae7746f0ce5e56a15c4087d4ec997bec84
Subproject commit ab42b2bf87bbb53b83ac46cdc1d1285b6439d064