mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 21:28:45 +00:00
ext/wavpack/gstwavpackdec.c: Don't use gst_pad_alloc_buffer() as we might clip the buffer later and
Original commit message from CVS: * ext/wavpack/gstwavpackdec.c: (gst_wavpack_dec_chain): Don't use gst_pad_alloc_buffer() as we might clip the buffer later and BaseTransform-based elements will likely break because of wrong unit-size. Also plug a possible memleak that happens when decoding fails for some reason.
This commit is contained in:
parent
0abc869e3e
commit
3a12608d1c
2 changed files with 16 additions and 10 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2007-03-22 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
|
* ext/wavpack/gstwavpackdec.c: (gst_wavpack_dec_chain):
|
||||||
|
Don't use gst_pad_alloc_buffer() as we might clip the buffer later and
|
||||||
|
BaseTransform-based elements will likely break because of wrong
|
||||||
|
unit-size. Also plug a possible memleak that happens when decoding
|
||||||
|
fails for some reason.
|
||||||
|
|
||||||
2007-03-18 Wim Taymans <wim@fluendo.com>
|
2007-03-18 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
Based on patch by: Paul Davis <paul at linuxaudiosystems dot com>
|
Based on patch by: Paul Davis <paul at linuxaudiosystems dot com>
|
||||||
|
|
|
@ -353,22 +353,20 @@ gst_wavpack_dec_chain (GstPad * pad, GstBuffer * buf)
|
||||||
gst_wavpack_dec_post_tags (dec, &wph);
|
gst_wavpack_dec_post_tags (dec, &wph);
|
||||||
}
|
}
|
||||||
|
|
||||||
unpacked_size = wph.block_samples * (dec->width / 8) * dec->channels;
|
|
||||||
|
|
||||||
/* alloc buffer */
|
|
||||||
ret = gst_pad_alloc_buffer (dec->srcpad, GST_BUFFER_OFFSET (buf),
|
|
||||||
unpacked_size, GST_PAD_CAPS (dec->srcpad), &outbuf);
|
|
||||||
|
|
||||||
if (ret != GST_FLOW_OK)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
/* decode */
|
/* decode */
|
||||||
unpack_buf = g_new (int32_t, wph.block_samples * dec->channels);
|
unpack_buf = g_new (int32_t, wph.block_samples * dec->channels);
|
||||||
decoded = WavpackUnpackSamples (dec->context, unpack_buf, wph.block_samples);
|
decoded = WavpackUnpackSamples (dec->context, unpack_buf, wph.block_samples);
|
||||||
if (decoded != wph.block_samples)
|
if (decoded != wph.block_samples)
|
||||||
goto decode_error;
|
goto decode_error;
|
||||||
|
|
||||||
/* put samples into outbuf buffer */
|
/* alloc output buffer. Can't use gst_pad_alloc_buffer() because of
|
||||||
|
* possible clipping which will cause problems with BaseTransform
|
||||||
|
* elements because of the unit size */
|
||||||
|
unpacked_size = wph.block_samples * (dec->width / 8) * dec->channels;
|
||||||
|
outbuf = gst_buffer_new_and_alloc (unpacked_size);
|
||||||
|
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (dec->srcpad));
|
||||||
|
|
||||||
|
/* put samples into output buffer */
|
||||||
gst_wavpack_dec_format_samples (dec, GST_BUFFER_DATA (outbuf),
|
gst_wavpack_dec_format_samples (dec, GST_BUFFER_DATA (outbuf),
|
||||||
unpack_buf, wph.block_samples);
|
unpack_buf, wph.block_samples);
|
||||||
gst_buffer_stamp (outbuf, buf);
|
gst_buffer_stamp (outbuf, buf);
|
||||||
|
|
Loading…
Reference in a new issue