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:
parent
43e8ebd055
commit
d41a578735
|
@ -552,7 +552,8 @@ void CoreAV::stateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t state, voi
|
||||||
&& !(state & TOXAV_FRIEND_CALL_STATE_SENDING_V))
|
&& !(state & TOXAV_FRIEND_CALL_STATE_SENDING_V))
|
||||||
{
|
{
|
||||||
qDebug() << "Friend"<<friendNum<<"stopped sending video";
|
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)
|
else if (!(call.state & TOXAV_FRIEND_CALL_STATE_SENDING_V)
|
||||||
&& (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"
|
// 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).
|
// 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
|
// 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);
|
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))
|
if (!calls.contains(friendNum))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ToxFriendCall& call = calls[friendNum];
|
||||||
|
if (!call.videoSource)
|
||||||
|
return;
|
||||||
|
|
||||||
vpx_image frame;
|
vpx_image frame;
|
||||||
frame.d_h = h;
|
frame.d_h = h;
|
||||||
frame.d_w = w;
|
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[1] = ustride;
|
||||||
frame.stride[2] = vstride;
|
frame.stride[2] = vstride;
|
||||||
|
|
||||||
ToxFriendCall& call = calls[friendNum];
|
|
||||||
call.videoSource->pushFrame(&frame);
|
call.videoSource->pushFrame(&frame);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user