mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
ext/jpeg/gstjpegdec.c (gst_jpegdec_chain): Allocate the buffer after setting caps. Fixes mysterious segfault. Blessed...
Original commit message from CVS: * ext/jpeg/gstjpegdec.c (gst_jpegdec_chain): Allocate the buffer after setting caps. Fixes mysterious segfault. Blessed by Wim.
This commit is contained in:
parent
e3beb3a1d5
commit
5af4bfcabd
2 changed files with 17 additions and 12 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2004-09-20 Johan Dahlin <johan@gnome.org>
|
||||||
|
|
||||||
|
* ext/jpeg/gstjpegdec.c (gst_jpegdec_chain): Allocate the buffer
|
||||||
|
after setting caps.
|
||||||
|
|
||||||
2004-09-19 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
2004-09-19 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
||||||
|
|
||||||
* gst/wavenc/gstwavenc.c: (gst_wavenc_init), (gst_wavenc_chain):
|
* gst/wavenc/gstwavenc.c: (gst_wavenc_init), (gst_wavenc_chain):
|
||||||
|
|
|
@ -406,18 +406,6 @@ gst_jpegdec_chain (GstPad * pad, GstData * _data)
|
||||||
width = jpegdec->cinfo.output_width;
|
width = jpegdec->cinfo.output_width;
|
||||||
height = jpegdec->cinfo.output_height;
|
height = jpegdec->cinfo.output_height;
|
||||||
|
|
||||||
/* FIXME: someone needs to do the work to figure out how to correctly
|
|
||||||
* calculate an output size that takes into account everything libjpeg
|
|
||||||
* needs, like padding for DCT size and so on. */
|
|
||||||
outsize = width * height + width * height / 2;
|
|
||||||
outbuf = gst_pad_alloc_buffer (jpegdec->srcpad, GST_BUFFER_OFFSET_NONE,
|
|
||||||
outsize);
|
|
||||||
outdata = GST_BUFFER_DATA (outbuf);
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
|
|
||||||
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
|
|
||||||
GST_LOG_OBJECT (jpegdec, "width %d, height %d, buffer size %d", width,
|
|
||||||
height, outsize);
|
|
||||||
|
|
||||||
if (jpegdec->height != height || jpegdec->line[0] == NULL) {
|
if (jpegdec->height != height || jpegdec->line[0] == NULL) {
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
|
@ -437,6 +425,18 @@ gst_jpegdec_chain (GstPad * pad, GstData * _data)
|
||||||
gst_caps_free (caps);
|
gst_caps_free (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: someone needs to do the work to figure out how to correctly
|
||||||
|
* calculate an output size that takes into account everything libjpeg
|
||||||
|
* needs, like padding for DCT size and so on. */
|
||||||
|
outsize = width * height + width * height / 2;
|
||||||
|
outbuf = gst_pad_alloc_buffer (jpegdec->srcpad, GST_BUFFER_OFFSET_NONE,
|
||||||
|
outsize);
|
||||||
|
outdata = GST_BUFFER_DATA (outbuf);
|
||||||
|
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
|
||||||
|
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
|
||||||
|
GST_LOG_OBJECT (jpegdec, "width %d, height %d, buffer size %d", width,
|
||||||
|
height, outsize);
|
||||||
|
|
||||||
/* mind the swap, jpeglib outputs blue chroma first */
|
/* mind the swap, jpeglib outputs blue chroma first */
|
||||||
/* FIXME: this needs stride love */
|
/* FIXME: this needs stride love */
|
||||||
base[0] = outdata;
|
base[0] = outdata;
|
||||||
|
|
Loading…
Reference in a new issue