diff options
author | Dave Craig <davecraig@unbalancedaudio.com> | 2015-12-15 17:10:00 +0000 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-12-16 10:12:44 +0100 |
commit | 328346ad210f1e64e147acac770024aa668b82e8 (patch) | |
tree | 2622fab0f5b80688e12bbd91667b01e32162a8a2 | |
parent | bf74d37c4ef30cecc3907c029ce4792f69d00f68 (diff) |
audioparsers: Check for NULL return value of gst_pad_get_current_caps()
https://bugzilla.gnome.org/show_bug.cgi?id=759503
-rw-r--r-- | gst/audioparsers/gstaacparse.c | 13 | ||||
-rw-r--r-- | gst/audioparsers/gstac3parse.c | 13 | ||||
-rw-r--r-- | gst/audioparsers/gstamrparse.c | 13 | ||||
-rw-r--r-- | gst/audioparsers/gstdcaparse.c | 13 | ||||
-rw-r--r-- | gst/audioparsers/gstflacparse.c | 9 | ||||
-rw-r--r-- | gst/audioparsers/gstmpegaudioparse.c | 11 | ||||
-rw-r--r-- | gst/audioparsers/gstsbcparse.c | 13 | ||||
-rw-r--r-- | gst/audioparsers/gstwavpackparse.c | 13 |
8 files changed, 86 insertions, 12 deletions
diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c index 3e4d64cc2..2be97c09c 100644 --- a/gst/audioparsers/gstaacparse.c +++ b/gst/audioparsers/gstaacparse.c @@ -1370,10 +1370,19 @@ gst_aac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) GstTagList *taglist; GstCaps *caps; - taglist = gst_tag_list_new_empty (); - /* codec tag */ caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse)); + if (caps == NULL) { + if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (parse))) { + GST_INFO_OBJECT (parse, "Src pad is flushing"); + return GST_FLOW_FLUSHING; + } else { + GST_INFO_OBJECT (parse, "Src pad is not negotiated!"); + return GST_FLOW_NOT_NEGOTIATED; + } + } + + taglist = gst_tag_list_new_empty (); gst_pb_utils_add_codec_description_to_tag_list (taglist, GST_TAG_AUDIO_CODEC, caps); gst_caps_unref (caps); diff --git a/gst/audioparsers/gstac3parse.c b/gst/audioparsers/gstac3parse.c index a7b2475a4..875f9cb1b 100644 --- a/gst/audioparsers/gstac3parse.c +++ b/gst/audioparsers/gstac3parse.c @@ -786,10 +786,19 @@ gst_ac3_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) GstTagList *taglist; GstCaps *caps; - taglist = gst_tag_list_new_empty (); - /* codec tag */ caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse)); + if (G_UNLIKELY (caps == NULL)) { + if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (parse))) { + GST_INFO_OBJECT (parse, "Src pad is flushing"); + return GST_FLOW_FLUSHING; + } else { + GST_INFO_OBJECT (parse, "Src pad is not negotiated!"); + return GST_FLOW_NOT_NEGOTIATED; + } + } + + taglist = gst_tag_list_new_empty (); gst_pb_utils_add_codec_description_to_tag_list (taglist, GST_TAG_AUDIO_CODEC, caps); gst_caps_unref (caps); diff --git a/gst/audioparsers/gstamrparse.c b/gst/audioparsers/gstamrparse.c index b9501d5d8..557afc9bf 100644 --- a/gst/audioparsers/gstamrparse.c +++ b/gst/audioparsers/gstamrparse.c @@ -426,10 +426,19 @@ gst_amr_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) GstTagList *taglist; GstCaps *caps; - taglist = gst_tag_list_new_empty (); - /* codec tag */ caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse)); + if (G_UNLIKELY (caps == NULL)) { + if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (parse))) { + GST_INFO_OBJECT (parse, "Src pad is flushing"); + return GST_FLOW_FLUSHING; + } else { + GST_INFO_OBJECT (parse, "Src pad is not negotiated!"); + return GST_FLOW_NOT_NEGOTIATED; + } + } + + taglist = gst_tag_list_new_empty (); gst_pb_utils_add_codec_description_to_tag_list (taglist, GST_TAG_AUDIO_CODEC, caps); gst_caps_unref (caps); diff --git a/gst/audioparsers/gstdcaparse.c b/gst/audioparsers/gstdcaparse.c index cfe97e1eb..380932381 100644 --- a/gst/audioparsers/gstdcaparse.c +++ b/gst/audioparsers/gstdcaparse.c @@ -565,10 +565,19 @@ gst_dca_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) GstTagList *taglist; GstCaps *caps; - taglist = gst_tag_list_new_empty (); - /* codec tag */ caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse)); + if (G_UNLIKELY (caps == NULL)) { + if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (parse))) { + GST_INFO_OBJECT (parse, "Src pad is flushing"); + return GST_FLOW_FLUSHING; + } else { + GST_INFO_OBJECT (parse, "Src pad is not negotiated!"); + return GST_FLOW_NOT_NEGOTIATED; + } + } + + taglist = gst_tag_list_new_empty (); gst_pb_utils_add_codec_description_to_tag_list (taglist, GST_TAG_AUDIO_CODEC, caps); gst_caps_unref (caps); diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c index bf598c7a2..693960493 100644 --- a/gst/audioparsers/gstflacparse.c +++ b/gst/audioparsers/gstflacparse.c @@ -1708,6 +1708,15 @@ gst_flac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) /* codec tag */ caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse)); + if (G_UNLIKELY (caps == NULL)) { + if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (parse))) { + GST_INFO_OBJECT (parse, "Src pad is flushing"); + return GST_FLOW_FLUSHING; + } else { + GST_INFO_OBJECT (parse, "Src pad is not negotiated!"); + return GST_FLOW_NOT_NEGOTIATED; + } + } gst_pb_utils_add_codec_description_to_tag_list (flacparse->tags, GST_TAG_AUDIO_CODEC, caps); gst_caps_unref (caps); diff --git a/gst/audioparsers/gstmpegaudioparse.c b/gst/audioparsers/gstmpegaudioparse.c index ba4441d9c..1a5313af8 100644 --- a/gst/audioparsers/gstmpegaudioparse.c +++ b/gst/audioparsers/gstmpegaudioparse.c @@ -1361,6 +1361,17 @@ gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse, /* codec tag */ caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse)); + if (G_UNLIKELY (caps == NULL)) { + gst_tag_list_unref (taglist); + + if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (parse))) { + GST_INFO_OBJECT (parse, "Src pad is flushing"); + return GST_FLOW_FLUSHING; + } else { + GST_INFO_OBJECT (parse, "Src pad is not negotiated!"); + return GST_FLOW_NOT_NEGOTIATED; + } + } gst_pb_utils_add_codec_description_to_tag_list (taglist, GST_TAG_AUDIO_CODEC, caps); gst_caps_unref (caps); diff --git a/gst/audioparsers/gstsbcparse.c b/gst/audioparsers/gstsbcparse.c index 4412e2bd3..577651193 100644 --- a/gst/audioparsers/gstsbcparse.c +++ b/gst/audioparsers/gstsbcparse.c @@ -507,10 +507,19 @@ gst_sbc_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) GstTagList *taglist; GstCaps *caps; - taglist = gst_tag_list_new_empty (); - /* codec tag */ caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse)); + if (G_UNLIKELY (caps == NULL)) { + if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (parse))) { + GST_INFO_OBJECT (parse, "Src pad is flushing"); + return GST_FLOW_FLUSHING; + } else { + GST_INFO_OBJECT (parse, "Src pad is not negotiated!"); + return GST_FLOW_NOT_NEGOTIATED; + } + } + + taglist = gst_tag_list_new_empty (); gst_pb_utils_add_codec_description_to_tag_list (taglist, GST_TAG_AUDIO_CODEC, caps); gst_caps_unref (caps); diff --git a/gst/audioparsers/gstwavpackparse.c b/gst/audioparsers/gstwavpackparse.c index 3c6e27a86..ce85c5b60 100644 --- a/gst/audioparsers/gstwavpackparse.c +++ b/gst/audioparsers/gstwavpackparse.c @@ -680,10 +680,19 @@ gst_wavpack_parse_pre_push_frame (GstBaseParse * parse, GstTagList *taglist; GstCaps *caps; - taglist = gst_tag_list_new_empty (); - /* codec tag */ caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse)); + if (G_UNLIKELY (caps == NULL)) { + if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (parse))) { + GST_INFO_OBJECT (parse, "Src pad is flushing"); + return GST_FLOW_FLUSHING; + } else { + GST_INFO_OBJECT (parse, "Src pad is not negotiated!"); + return GST_FLOW_NOT_NEGOTIATED; + } + } + + taglist = gst_tag_list_new_empty (); gst_pb_utils_add_codec_description_to_tag_list (taglist, GST_TAG_AUDIO_CODEC, caps); gst_caps_unref (caps); |