ext/ffmpeg/gstffmpegcodecmap.c: Pad extradata. Allocate dummy empty extradata because some codecs like to read it and...

Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
Pad extradata. Allocate dummy empty extradata because some codecs like
to read it and segfault when it's not there.
This commit is contained in:
Wim Taymans 2006-08-21 16:33:15 +00:00
parent fbe18ef096
commit d3f7b8582b
2 changed files with 21 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2006-08-21 Wim Taymans <wim@fluendo.com>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
Pad extradata. Allocate dummy empty extradata because some codecs like
to read it and segfault when it's not there.
2006-08-16 Wim Taymans <wim@fluendo.com>
Patch by: Mark Nauwelaerts <manauw at skynet dot be>

View file

@ -1367,11 +1367,21 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
/* extradata parsing (esds [mpeg4], wma/wmv, msmpeg4v1/2/3, etc.) */
if ((value = gst_structure_get_value (str, "codec_data"))) {
buf = GST_BUFFER (gst_value_get_mini_object (value));
context->extradata = av_mallocz (GST_ROUND_UP_16 (GST_BUFFER_SIZE (buf)));
memcpy (context->extradata, GST_BUFFER_DATA (buf),
GST_BUFFER_SIZE (buf));
context->extradata_size = GST_BUFFER_SIZE (buf);
gint size;
buf = GST_BUFFER_CAST (gst_value_get_mini_object (value));
size = GST_BUFFER_SIZE (buf);
/* allocate with enough padding */
context->extradata = av_mallocz (GST_ROUND_UP_16 (size + FF_INPUT_BUFFER_PADDING_SIZE));
memcpy (context->extradata, GST_BUFFER_DATA (buf), size);
context->extradata_size = size;
}
else {
/* no extradata, alloc dummy with 0 sized, some codecs insist on reading
* extradata anyway which makes then segfault. */
context->extradata = av_mallocz (GST_ROUND_UP_16 (FF_INPUT_BUFFER_PADDING_SIZE));
context->extradata_size = 0;
}
switch (codec_id) {