Skip to content

Commit

Permalink
bug fixed: playNextFrame() not work
Browse files Browse the repository at this point in the history
continue will never decode the next packet
  • Loading branch information
wang-bin committed Jan 17, 2013
1 parent ce718ef commit 1052d04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/AudioThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ void AudioThread::run()
static const double max_len = 0.02;
d.last_pts = 0;
while (!d.stop) {
if (tryPause())
continue; //the queue is empty and may block. should setBlocking(false) wake up cond empty?
//TODO: why put it at the end of loop then playNextFrame() not work?
if (tryPause()) { //DO NOT continue, or playNextFrame() will fail
if (d.stop)
break; //the queue is empty and may block. should setBlocking(false) wake up cond empty?
}
QMutexLocker locker(&d.mutex);
Q_UNUSED(locker);
if (d.packets.isEmpty() && !d.stop) {
Expand Down
7 changes: 5 additions & 2 deletions src/VideoThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ void VideoThread::run()
VideoDecoder *dec = static_cast<VideoDecoder*>(d.dec);
VideoRenderer* vo = static_cast<VideoRenderer*>(d.writer);
while (!d.stop) {
if (tryPause())
continue; //the queue is empty and may block. should setBlocking(false) wake up cond empty?
//TODO: why put it at the end of loop then playNextFrame() not work?
if (tryPause()) { //DO NOT continue, or playNextFrame() will fail
if (d.stop)
break; //the queue is empty and may block. should setBlocking(false) wake up cond empty?
}
QMutexLocker locker(&d.mutex);
Q_UNUSED(locker);
if (d.packets.isEmpty() && !d.stop) {
Expand Down

0 comments on commit 1052d04

Please sign in to comment.