pause avthread after seek finished

This commit is contained in:
wang-bin
2016-02-03 19:41:43 +08:00
parent 5a3af9b503
commit ccf3bd3ca4
2 changed files with 15 additions and 12 deletions
+8 -7
View File
@@ -87,13 +87,14 @@ void AudioThread::run()
int sync_id = 0;
while (!d.stop) {
processNextTask();
//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?
} else {
if (isPaused())
continue;
if (d.render_pts0 < 0) { // no pause when seeking
if (tryPause()) { //DO NOT continue, or stepForward() will fail
if (d.stop)
break; //the queue is empty and may block. should setBlocking(false) wake up cond empty?
} else {
if (isPaused())
continue;
}
}
if (d.seek_requested) {
d.seek_requested = false;
+7 -5
View File
@@ -295,11 +295,13 @@ void VideoThread::run()
processNextTask();
//TODO: why put it at the end of loop then stepForward() not work?
//processNextTask tryPause(timeout) and and continue outter loop
if (tryPause()) { //DO NOT continue, or stepForward() will fail
if (d.render_pts0 < 0) { // no pause when seeking
if (tryPause()) { //DO NOT continue, or stepForward() will fail
} else {
if (isPaused())
continue; //timeout. process pending tasks
} else {
if (isPaused())
continue; //timeout. process pending tasks
}
}
if (d.seek_requested) {
d.seek_requested = false;
@@ -344,7 +346,7 @@ void VideoThread::run()
continue;
}
}
if (pkt.pts <= 0) {
if (pkt.pts <= 0 && !pkt.isEOF() && pkt.data.size() > 0) {
nb_no_pts++;
} else {
nb_no_pts = 0;