From b77dab0f6e7a43d9a9480626805317df7843bf7a Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 24 Jul 2014 15:25:48 +0200 Subject: audio: cosmetics Move a function call, which does not change semantics. Write the extra buffer sample count in a more straight-forward way; the old code was not meaningful in any way (anymore). --- audio/decode/dec_audio.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'audio') diff --git a/audio/decode/dec_audio.c b/audio/decode/dec_audio.c index 5abb13f1f4..4cd823e029 100644 --- a/audio/decode/dec_audio.c +++ b/audio/decode/dec_audio.c @@ -244,11 +244,10 @@ static int filter_n_bytes(struct dec_audio *da, struct mp_audio_buffer *outbuf, { int error = 0; - struct mp_audio config; - mp_audio_buffer_get_format(da->decode_buffer, &config); - while (mp_audio_buffer_samples(da->decode_buffer) < len) { - // Format change + // Check for a format change + struct mp_audio config; + mp_audio_buffer_get_format(da->decode_buffer, &config); if (!mp_audio_config_equals(&da->decoded, &config)) { // If there are still samples left in the buffer, let them drain // first, and don't signal a format change to the caller yet. @@ -307,9 +306,6 @@ int audio_decode(struct dec_audio *d_audio, struct mp_audio_buffer *outbuf, { // Indicates that a filter seems to be buffering large amounts of data int huge_filter_buffer = 0; - // Decoded audio must be cut at boundaries of this many samples - // (Note: the reason for this is unknown, possibly a refactoring artifact) - int unitsize = 16; /* Filter output size will be about filter_multiplier times input size. * If some filter buffers audio in big blocks this might only hold @@ -326,8 +322,8 @@ int audio_decode(struct dec_audio *d_audio, struct mp_audio_buffer *outbuf, prev_buffered = buffered; int decsamples = (minsamples - buffered) / filter_multiplier; - // + some extra for possible filter buffering - decsamples += unitsize << 5; + // + some extra for possible filter buffering, and avoid 0 + decsamples += 512; if (huge_filter_buffer) { /* Some filter must be doing significant buffering if the estimated -- cgit v1.2.3