diff options
author | James Almer <jamrial@gmail.com> | 2016-12-23 21:47:03 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2016-12-23 21:47:03 -0300 |
commit | 94eb600f354c486fd3a9b50e052e809452673fcf (patch) | |
tree | 81ca7ccf4932cae1e92cae5ec38839256db55cf3 | |
parent | 03ce71e4a1187340720e1569ac96c285c145a1f7 (diff) | |
download | ffmpeg-94eb600f354c486fd3a9b50e052e809452673fcf.tar.gz |
tests/audio_fifo: fix buffer allocation for non planar formats
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r-- | libavutil/tests/audio_fifo.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavutil/tests/audio_fifo.c b/libavutil/tests/audio_fifo.c index dbadded7cd..34c8573149 100644 --- a/libavutil/tests/audio_fifo.c +++ b/libavutil/tests/audio_fifo.c @@ -81,11 +81,11 @@ static void print_audio_bytes(const TestStruct *test_sample, void **data_planes, static int read_samples_from_audio_fifo(AVAudioFifo* afifo, void ***output, int nb_samples) { - int i, planes; + int i; int samples = FFMIN(nb_samples, afifo->nb_samples); - int tot_elements = !(planes = av_sample_fmt_is_planar(afifo->sample_fmt)) + int tot_elements = !av_sample_fmt_is_planar(afifo->sample_fmt) ? samples : afifo->channels * samples; - void **data_planes = allocate_memory(sizeof(void*) * planes); + void **data_planes = allocate_memory(sizeof(void*) * afifo->nb_buffers); *output = data_planes; for (i = 0; i < afifo->nb_buffers; ++i){ |