player: don't leave buffering during underflow

Don't leave the buffering state while the demuxer is still marked as
having underflowed. It's unclear why this hasn't been done before - with
the logic being complicated as it is, maybe there was a reason for this.

This is actually still not very reliable, but should be better than what
was before: on stream switching decoders can read packets all while the
demuxer is executing a refresh seek, which creates the underrun
situation - but nothing really totally guarantees that the underrun
state remains stable when the demuxer is back at the current demuxer
position. Anyway, it's an improvement.

The rest of the touched condition is not changed, just moved around for
cosmetic reasons.
This commit is contained in:
wm4 2016-10-21 17:07:07 +02:00
parent 61a51c57a9
commit f64de3ea66
1 changed files with 2 additions and 2 deletions

View File

@ -608,8 +608,8 @@ static void handle_pause_on_low_cache(struct MPContext *mpctx)
if (mpctx->restart_complete && c.size > 0) {
if (mpctx->paused && mpctx->paused_for_cache) {
if (!opts->cache_pausing || s.ts_duration >= mpctx->cache_wait_time
|| s.idle)
if (!s.underrun && (!opts->cache_pausing || s.idle ||
s.ts_duration >= mpctx->cache_wait_time))
{
double elapsed_time = now - mpctx->cache_stop_time;
if (elapsed_time > mpctx->cache_wait_time) {