Skip to content

Commit

Permalink
no wait for invalid pts
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed May 30, 2018
1 parent 7793e94 commit f1ce3f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/AVThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ bool AVThread::waitForStarted(int msec)
void AVThread::waitAndCheck(ulong value, qreal pts)
{
DPTR_D(AVThread);
if (value <= 0)
if (value <= 0 || pts < 0)
return;
value += d.wait_err;
d.wait_timer.restart();
Expand All @@ -383,8 +383,10 @@ void AVThread::waitAndCheck(ulong value, qreal pts)
//qDebug("us: %lu/%lu, pts: %f, clock: %f", us, ms-et.elapsed(), pts, d.clock->value());
processNextTask();
const qint64 left = qint64(ms) - d.wait_timer.elapsed();
if (left <= 0)
if (left <= 0) {
us = 0;
break;
}
us = qMin<ulong>(us, left*1000);
}
if (us > 0)
Expand Down

0 comments on commit f1ce3f5

Please sign in to comment.