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

Stop trying to play audio in dead calls

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-06-27 19:01:01 +02:00
parent f5a628fafb
commit 104b874cb5

View File

@ -1076,9 +1076,13 @@ void Core::playCallAudio(int callId, ToxAv* toxav)
int framesize = (calls[callId].codecSettings.audio_frame_duration * calls[callId].codecSettings.audio_sample_rate) / 1000; int framesize = (calls[callId].codecSettings.audio_frame_duration * calls[callId].codecSettings.audio_sample_rate) / 1000;
uint8_t buf[framesize*2]; uint8_t buf[framesize*2];
int len = toxav_recv_audio(toxav, callId, framesize, (int16_t*)buf); int len = toxav_recv_audio(toxav, callId, framesize, (int16_t*)buf);
qDebug() << QString("Core: Received %1 audio bytes").arg(len);
if (len < 0) if (len < 0)
{ {
if (len == -3) // Not in call !
{
qWarning("Core: Trying to play audio in an inactive call!");
return;
}
qDebug() << QString("Core::playCallAudio: Error receiving audio: %1").arg(len); qDebug() << QString("Core::playCallAudio: Error receiving audio: %1").arg(len);
QThread::msleep(5); QThread::msleep(5);
continue; continue;