summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-17 22:45:49 +0200
committerwm4 <wm4@nowhere>2014-04-17 22:45:49 +0200
commitfe298bc2a571405f38343eb9c6280f694db49ffa (patch)
tree76a6e240aa51ee5e5afa9775ebd13f814b06e628
parent1b92f3b47277f189646885c1757d424868a0da47 (diff)
downloadmpv-fe298bc2a571405f38343eb9c6280f694db49ffa.tar.bz2
mpv-fe298bc2a571405f38343eb9c6280f694db49ffa.tar.xz
audio: explicitly document audio EOF condition
This should probably be an AO function, but since the playloop still has some strange stuff (using the buffered_audio variable instead of calling ao_get_delay() directly), just leave it and make it more explicit.
-rw-r--r--audio/out/ao.h5
-rw-r--r--player/playloop.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/audio/out/ao.h b/audio/out/ao.h
index e462fcf4d5..056cdf7295 100644
--- a/audio/out/ao.h
+++ b/audio/out/ao.h
@@ -49,6 +49,11 @@ typedef struct ao_control_vol {
float right;
} ao_control_vol_t;
+// If ao_get_delay() reaches this value after ao_play() was called with the
+// AOPLAY_FINAL_CHUNK flag set, the playback core expects that the audio has
+// all been played.
+#define AO_EOF_DELAY 0.05
+
struct ao;
struct mpv_global;
struct input_ctx;
diff --git a/player/playloop.c b/player/playloop.c
index 2495579c39..61a2ac0c20 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -1219,7 +1219,7 @@ void run_playloop(struct MPContext *mpctx)
* buffered.
*/
if ((mpctx->d_audio || mpctx->d_video) && !audio_left && !video_left
- && (opts->gapless_audio || buffered_audio < 0.05)
+ && (opts->gapless_audio || buffered_audio < AO_EOF_DELAY)
&& (!mpctx->paused || was_restart)) {
if (end_is_chapter) {
mp_seek(mpctx, (struct seek_params){