Skip to content

Commit f1ce3f5

Browse files
committed
no wait for invalid pts
1 parent 7793e94 commit f1ce3f5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/AVThread.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ bool AVThread::waitForStarted(int msec)
364364
void AVThread::waitAndCheck(ulong value, qreal pts)
365365
{
366366
DPTR_D(AVThread);
367-
if (value <= 0)
367+
if (value <= 0 || pts < 0)
368368
return;
369369
value += d.wait_err;
370370
d.wait_timer.restart();
@@ -383,8 +383,10 @@ void AVThread::waitAndCheck(ulong value, qreal pts)
383383
//qDebug("us: %lu/%lu, pts: %f, clock: %f", us, ms-et.elapsed(), pts, d.clock->value());
384384
processNextTask();
385385
const qint64 left = qint64(ms) - d.wait_timer.elapsed();
386-
if (left <= 0)
386+
if (left <= 0) {
387+
us = 0;
387388
break;
389+
}
388390
us = qMin<ulong>(us, left*1000);
389391
}
390392
if (us > 0)

0 commit comments

Comments
 (0)