1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix crash on audio -> video call promotion

We just ignore it and not show the received video for now.
Fixes #2505
This commit is contained in:
tux3 2015-11-06 12:41:15 +01:00
parent 43e8ebd055
commit d41a578735
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -552,7 +552,8 @@ void CoreAV::stateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t state, voi
&& !(state & TOXAV_FRIEND_CALL_STATE_SENDING_V))
{
qDebug() << "Friend"<<friendNum<<"stopped sending video";
call.videoSource->stopSource();
if (call.videoSource)
call.videoSource->stopSource();
}
else if (!(call.state & TOXAV_FRIEND_CALL_STATE_SENDING_V)
&& (state & TOXAV_FRIEND_CALL_STATE_SENDING_V))
@ -560,7 +561,8 @@ void CoreAV::stateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t state, voi
// Workaround toxav sometimes firing callbacks for "send last frame" -> "stop sending video"
// out of orders (even though they were sent in order by the other end).
// We simply stop the videoSource from emitting anything while the other end says it's not sending
call.videoSource->restartSource();
if (call.videoSource)
call.videoSource->restartSource();
}
call.state = static_cast<TOXAV_FRIEND_CALL_STATE>(state);
@ -608,6 +610,10 @@ void CoreAV::videoFrameCallback(ToxAV *, uint32_t friendNum, uint16_t w, uint16_
if (!calls.contains(friendNum))
return;
ToxFriendCall& call = calls[friendNum];
if (!call.videoSource)
return;
vpx_image frame;
frame.d_h = h;
frame.d_w = w;
@ -618,6 +624,5 @@ void CoreAV::videoFrameCallback(ToxAV *, uint32_t friendNum, uint16_t w, uint16_
frame.stride[1] = ustride;
frame.stride[2] = vstride;
ToxFriendCall& call = calls[friendNum];
call.videoSource->pushFrame(&frame);
}