vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Thu Oct 13 18:41:01 2011 +0300| [1e1f9d10fe0840d515757a5897014b3a5107e045] | committer: Rémi Denis-Courmont
Drain audio output before we claim the buffers are empty This fixes the last bits of audio loss at end of stream... for the audio output implementing drain (ALSA and PulseAudio so far). > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1e1f9d10fe0840d515757a5897014b3a5107e045 --- src/audio_output/dec.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c index 4a47ed1..85b0c15 100644 --- a/src/audio_output/dec.c +++ b/src/audio_output/dec.c @@ -367,13 +367,19 @@ void aout_DecFlush (audio_output_t *aout) bool aout_DecIsEmpty (audio_output_t *aout) { aout_owner_t *owner = aout_owner (aout); - mtime_t end_date; + mtime_t end_date, now = mdate (); + bool empty; aout_lock (aout); - /* FIXME: tell output to drain */ end_date = date_Get (&owner->sync.date); + empty = end_date == VLC_TS_INVALID || end_date <= now; + if (empty) + /* The last PTS has elapsed already. So the underlying audio output + * buffer should be empty or almost. Thus draining should be fast + * and will not block the caller too long. */ + aout_OutputFlush (aout, true); aout_unlock (aout); - return end_date == VLC_TS_INVALID || end_date <= mdate(); + return empty; } /** _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
