summaryrefslogtreecommitdiff
path: root/libavcodec/resample.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-17 23:16:05 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-17 23:16:05 +0100
commit967bdb8572f27b9891fe7bd9b8489146a906633d (patch)
tree61b486be897a4503f71e2ecc7734f16930dc1a94 /libavcodec/resample.c
parent219a6fb61cb9e6f534f20dc3313442f89b0ffd42 (diff)
parent6ca3b248e21fc48418c4221fc92c2eecaf07cb9b (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: resample: allocate a large enough output buffer fate: fix enc_dec_pcm tests with remote target wmaenc: remove bit-exact hack FATE: remove WMA acodec tests FATE: add WMAv1 and WMAv2 encode/decode tests with fuzzy comparison FATE: add AC-3 and E-AC-3 encode/decode tests with fuzzy comparison qtrle: Use bytestream2 functions to prevent buffer overreads. vqavideo: check malloc return values x11grab: fix a memory leak exposed by valgrind threads: fix old frames returned after avcodec_flush_buffers() MPV: always mark dummy frames as reference h264: fix deadlocks on incomplete reference frame decoding. mpeg4: report frame decoding completion at ff_MPV_frame_end(). mimic: don't use self as reference, and report completion at end of decode(). Conflicts: libavcodec/h264.c libavcodec/qtrle.c libavcodec/resample.c libavcodec/vqavideo.c libavdevice/x11grab.c tests/ref/seek/wmav1_asf tests/ref/seek/wmav2_asf Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/resample.c')
-rw-r--r--libavcodec/resample.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/resample.c b/libavcodec/resample.c
index f1a2dbf6dc..a601e7aac7 100644
--- a/libavcodec/resample.c
+++ b/libavcodec/resample.c
@@ -323,11 +323,13 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
lenout= 2*s->output_channels*nb_samples * s->ratio + 16;
if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) {
+ int out_size = lenout * av_get_bytes_per_sample(s->sample_fmt[1]) *
+ s->output_channels;
output_bak = output;
- if (!s->buffer_size[1] || s->buffer_size[1] < 2*lenout) {
+ if (!s->buffer_size[1] || s->buffer_size[1] < out_size) {
av_free(s->buffer[1]);
- s->buffer_size[1] = 2*lenout;
+ s->buffer_size[1] = out_size;
s->buffer[1] = av_malloc(s->buffer_size[1]);
if (!s->buffer[1]) {
av_log(s->resample_context, AV_LOG_ERROR, "Could not allocate buffer\n");