From fb9b119a5a940f868e167af11939c47b7a569012 Mon Sep 17 00:00:00 2001 From: wang-bin Date: Sun, 9 Nov 2014 23:32:35 +0800 Subject: [PATCH] fix audio only stream finish reading too early --- src/AVDemuxThread.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/AVDemuxThread.cpp b/src/AVDemuxThread.cpp index 8cefaf6b7..e579f5646 100644 --- a/src/AVDemuxThread.cpp +++ b/src/AVDemuxThread.cpp @@ -380,18 +380,18 @@ void AVDemuxThread::run() aqueue->clear(); continue; } - if (vqueue) - aqueue->blockFull(vqueue->isEnough() || demuxer->hasAttacedPicture()); + // always block full if no vqueue because empty callback may set false + // attached picture is cover for song, 1 frame + aqueue->blockFull(!vqueue || (vqueue->isEnough() || demuxer->hasAttacedPicture())); aqueue->put(pkt); //affect video_thread } } else if (index == video_stream) { - if (!video_thread || !video_thread->isRunning()) { - vqueue->clear(); - continue; - } if (vqueue) { - if (aqueue) - vqueue->blockFull(aqueue->isEnough()); + if (!video_thread || !video_thread->isRunning()) { + vqueue->clear(); + continue; + } + vqueue->blockFull(!aqueue || aqueue->isEnough()); vqueue->put(pkt); //affect audio_thread } } else { //subtitle