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

Improve video quality

Double the allowed bitrate, this is especially noticeable on desktop streaming. Desktop streaming is still completely broken, with what looks like iframes silently getting dropped on a regular basis.

Retry 5 times to send a frame when there's an internal toxav lock sync error, this allows us to drop way less frames.
This commit is contained in:
tux3 2015-12-04 12:53:58 +01:00
parent ef5cb2689c
commit 37075dbfb5
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 22 additions and 4 deletions

View File

@ -312,9 +312,27 @@ void CoreAV::sendCallVideo(uint32_t callId, shared_ptr<VideoFrame> vframe)
return;
}
if (!toxav_video_send_frame(toxav, callId, frame->d_w, frame->d_h,
frame->planes[0], frame->planes[1], frame->planes[2], nullptr))
qDebug() << "toxav_video_send_frame error";
// TOXAV_ERR_SEND_FRAME_SYNC means toxav failed to lock, retry 5 times in this case
// We don't want to be dropping iframes because of some lock held by toxav_iterate
TOXAV_ERR_SEND_FRAME err;
int retries = 0;
do {
if (!toxav_video_send_frame(toxav, callId, frame->d_w, frame->d_h,
frame->planes[0], frame->planes[1], frame->planes[2], &err))
{
if (err == TOXAV_ERR_SEND_FRAME_SYNC)
{
retries++;
QThread::usleep(500);
}
else
{
qDebug() << "toxav_video_send_frame error: "<<err;
}
}
} while (err == TOXAV_ERR_SEND_FRAME_SYNC && retries < 5);
if (err == TOXAV_ERR_SEND_FRAME_SYNC)
qDebug() << "toxav_video_send_frame error: Lock busy, dropping frame";
delete frame;
}

View File

@ -113,7 +113,7 @@ private:
private:
static constexpr uint32_t AUDIO_DEFAULT_BITRATE = 64; ///< In kb/s. More than enough for Opus.
static constexpr uint32_t VIDEO_DEFAULT_BITRATE = 3000; ///< Picked at random by fair dice roll.
static constexpr uint32_t VIDEO_DEFAULT_BITRATE = 6144; ///< Picked at random by fair dice roll.
private:
ToxAV* toxav;