summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVineeth TM <vineeth.tm@samsung.com>2015-07-24 10:08:34 +0900
committerTim-Philipp Müller <tim@centricular.com>2015-07-30 13:40:09 +0100
commit5e7d0a828552dcc6f6ddf2bf08cf318a7cbd1d8d (patch)
treecd1d0c4b372782914b556b4b1ce63fe1649ef3da
parent171a1df6eb07af8a0422f8ab6243cce57dfd66aa (diff)
asfdemux: fix assertion error when codec_data is not present in structure
When discovering a particular asf file, caps structure doesn't have codec_data, and this was not being checked before using the same, resulting in assertion error https://bugzilla.gnome.org/show_bug.cgi?id=752803
-rwxr-xr-xgst/asfdemux/gstasfdemux.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c
index a8d316ed..4bf0619b 100755
--- a/gst/asfdemux/gstasfdemux.c
+++ b/gst/asfdemux/gstasfdemux.c
@@ -2572,18 +2572,20 @@ gst_asf_demux_add_video_stream (GstASFDemux * demux,
/* check if h264 has codec_data (avc) or streamheaders (bytestream) */
} else if (gst_structure_has_name (caps_s, "video/x-h264")) {
const GValue *value = gst_structure_get_value (caps_s, "codec_data");
- GstBuffer *buf = gst_value_get_buffer (value);
- GstMapInfo mapinfo;
-
- if (gst_buffer_map (buf, &mapinfo, GST_MAP_READ)) {
- if (mapinfo.size >= 4 && GST_READ_UINT32_BE (mapinfo.data) == 1) {
- /* this looks like a bytestream start */
- streamheader = gst_buffer_ref (buf);
- gst_asf_demux_add_stream_headers_to_caps (demux, buf, caps_s);
- gst_structure_remove_field (caps_s, "codec_data");
- }
+ if (value) {
+ GstBuffer *buf = gst_value_get_buffer (value);
+ GstMapInfo mapinfo;
+
+ if (gst_buffer_map (buf, &mapinfo, GST_MAP_READ)) {
+ if (mapinfo.size >= 4 && GST_READ_UINT32_BE (mapinfo.data) == 1) {
+ /* this looks like a bytestream start */
+ streamheader = gst_buffer_ref (buf);
+ gst_asf_demux_add_stream_headers_to_caps (demux, buf, caps_s);
+ gst_structure_remove_field (caps_s, "codec_data");
+ }
- gst_buffer_unmap (buf, &mapinfo);
+ gst_buffer_unmap (buf, &mapinfo);
+ }
}
}