summaryrefslogtreecommitdiffstats
path: root/mpvcore/player/playloop.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-08 20:02:09 +0100
committerwm4 <wm4@nowhere>2013-11-08 20:29:26 +0100
commit6354a6b07dd3e0aee23e71ee2574754d620bdd09 (patch)
tree2cd4137ddec69890434273774d4571786668e9e2 /mpvcore/player/playloop.c
parent8125252399d9b02a6f143d109a92341ff7eff5a9 (diff)
downloadmpv-6354a6b07dd3e0aee23e71ee2574754d620bdd09.tar.bz2
mpv-6354a6b07dd3e0aee23e71ee2574754d620bdd09.tar.xz
player: factor audio buffer clearing code
Note that the change in seek_reset is not entirely equivalent: we even drop the remainder of buffered audio when seeking. This should be more correct, because the whole point of the reset_ao parameter is to control whether audio queued for output should be dropped or not.
Diffstat (limited to 'mpvcore/player/playloop.c')
-rw-r--r--mpvcore/player/playloop.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/mpvcore/player/playloop.c b/mpvcore/player/playloop.c
index 6cd53214a2..9d5b4a5e25 100644
--- a/mpvcore/player/playloop.c
+++ b/mpvcore/player/playloop.c
@@ -185,9 +185,8 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao, bool reset_ac)
if (mpctx->sh_audio && reset_ac) {
resync_audio_stream(mpctx->sh_audio);
if (reset_ao)
- ao_reset(mpctx->ao);
- mpctx->ao->buffer.len = mpctx->ao->buffer_playable_size;
- mpctx->sh_audio->a_buffer_len = 0;
+ clear_audio_output_buffers(mpctx);
+ clear_audio_decode_buffers(mpctx);
}
reset_subtitles(mpctx);
@@ -256,10 +255,8 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek,
mpctx->stop_play = AT_END_OF_FILE;
if (mpctx->sh_audio && !timeline_fallthrough) {
// Seek outside of the file -> clear audio from current position
- ao_reset(mpctx->ao);
- mpctx->sh_audio->a_buffer_len = 0;
- mpctx->ao->buffer.len = 0;
- mpctx->ao->buffer_playable_size = 0;
+ clear_audio_decode_buffers(mpctx);
+ clear_audio_output_buffers(mpctx);
}
return -1;
}