From 3dae13383d00b4bc726b86be6e568a61ce03ab68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 16 Dec 2010 10:30:31 +0100 Subject: [PATCH] mad: If gst_pad_alloc_buffer() returns a buffer with the wrong size allocate a new one Fixes bug #635461. --- ext/mad/gstmad.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ext/mad/gstmad.c b/ext/mad/gstmad.c index d345023..3d76b4d 100644 --- a/ext/mad/gstmad.c +++ b/ext/mad/gstmad.c @@ -1728,6 +1728,13 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer) goto skip_frame; } + if (GST_BUFFER_SIZE (outbuffer) != nsamples * mad->channels * 4) { + gst_buffer_unref (outbuffer); + + outbuffer = gst_buffer_new_and_alloc (nsamples * mad->channels * 4); + gst_buffer_set_caps (outbuffer, GST_PAD_CAPS (mad->srcpad)); + } + mad_synth_frame (&mad->synth, &mad->frame); left_ch = mad->synth.pcm.samples[0]; right_ch = mad->synth.pcm.samples[1]; -- 2.7.4