diff options
author | Uoti Urpala <uau@mplayer2.org> | 2011-07-02 09:22:32 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-07-02 09:22:32 +0300 |
commit | c8b3088c1831ab5f698924ce75127caa55b50dbb (patch) | |
tree | 12ca3b7d7b53ff9458b80f2c83de2cf29d522862 /libao2/audio_out.c | |
parent | 746f9b004038e09392b69abb3ba26b1cc32a90d7 (diff) | |
download | mpv-c8b3088c1831ab5f698924ce75127caa55b50dbb.tar.bz2 mpv-c8b3088c1831ab5f698924ce75127caa55b50dbb.tar.xz |
audio: move ready-for-ao data buffer from decoder to AO
Move the buffer storing audio data ready to be fed to the audio output
driver from the audio decoder object to the AO object. This will help
encoding code deal with end of input, and may also be useful to
improve other general gapless audio behavior (as AOs which do not
accept chunks smaller than a certain size may keep them in the buffer
while the decoder changes).
Less data may be dropped now when changing audio filters or switching
timeline parts.
Diffstat (limited to 'libao2/audio_out.c')
-rw-r--r-- | libao2/audio_out.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libao2/audio_out.c b/libao2/audio_out.c index 14cab9b285..bd06c8fd5f 100644 --- a/libao2/audio_out.c +++ b/libao2/audio_out.c @@ -221,8 +221,12 @@ void ao_init(struct ao *ao, char **ao_list) void ao_uninit(struct ao *ao, bool cut_audio) { + assert(ao->buffer.len >= ao->buffer_playable_size); + ao->buffer.len = ao->buffer_playable_size; if (ao->initialized) ao->driver->uninit(ao, cut_audio); + if (!cut_audio && ao->buffer.len) + mp_msg(MSGT_AO, MSGL_WARN, "Audio output truncated at end.\n"); talloc_free(ao); } @@ -254,6 +258,8 @@ int ao_get_space(struct ao *ao) void ao_reset(struct ao *ao) { + ao->buffer.len = 0; + ao->buffer_playable_size = 0; if (ao->driver->reset) ao->driver->reset(ao); } |