summaryrefslogtreecommitdiffstats
path: root/player/audio.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-19 23:23:17 +0200
committerwm4 <wm4@nowhere>2015-05-19 23:23:17 +0200
commit402fe381d7a94c8596d1bed0c8e089b08a298e85 (patch)
tree1dad5b4b75d46a226458f757bf49d721353071db /player/audio.c
parent36529bc6f7a777899d06c6bb80b40b4e7a886464 (diff)
downloadmpv-402fe381d7a94c8596d1bed0c8e089b08a298e85.tar.bz2
mpv-402fe381d7a94c8596d1bed0c8e089b08a298e85.tar.xz
audio: fix resync issue different
Commit 10915000 attempted to fix wasting CPU when resyncing and no new data was actually coming from the demuxer. The fix assumed that at this point it would have reached the sync point, but since the code attempts weird incremental decoding, this wasn't actually true. So it broke seeking in addition to removing the CPU waste. Try something else. This time, we essentially only wakeup again if data was read (i.e. audio_decode() returned successfully).
Diffstat (limited to 'player/audio.c')
-rw-r--r--player/audio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/player/audio.c b/player/audio.c
index 7691b32563..034325594f 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -478,6 +478,7 @@ static void do_fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
}
int status = AD_OK;
+ bool working = false;
if (playsize > mp_audio_buffer_samples(mpctx->ao_buffer)) {
status = audio_decode(d_audio, mpctx->ao_buffer, playsize);
if (status == AD_WAIT)
@@ -495,6 +496,7 @@ static void do_fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
}
if (status == AD_ERR)
mpctx->sleeptime = 0;
+ working = true;
}
// If EOF was reached before, but now something can be decoded, try to
@@ -527,7 +529,7 @@ static void do_fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
mpctx->audio_status = STATUS_FILLING;
if (status != AD_OK && !mp_audio_buffer_samples(mpctx->ao_buffer))
mpctx->audio_status = STATUS_EOF;
- if (mpctx->audio_status != STATUS_SYNCING)
+ if (working)
mpctx->sleeptime = 0;
return; // continue on next iteration
}