diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2014-06-28 10:43:43 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-06-28 10:43:43 +0200 |
commit | fae814aef8472ada67a8e6ccfd67161c3ce3f1a3 (patch) | |
tree | e8253d620e5dafab03aebe7658031953e20a7e90 | |
parent | f1b99f04dc56b4a0c801c94cd7096f059eab314c (diff) | |
download | gstreamer-plugins-bad-fae814aef8472ada67a8e6ccfd67161c3ce3f1a3.tar.gz |
interaudiosrc: Fail in set_caps() if the caps can't be parsed
-rw-r--r-- | gst/inter/gstinteraudiosrc.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gst/inter/gstinteraudiosrc.c b/gst/inter/gstinteraudiosrc.c index ee8786e98..cab0eb680 100644 --- a/gst/inter/gstinteraudiosrc.c +++ b/gst/inter/gstinteraudiosrc.c @@ -195,17 +195,22 @@ gst_inter_audio_src_set_caps (GstBaseSrc * src, GstCaps * caps) structure = gst_caps_get_structure (caps, 0); - ret = gst_structure_get_int (structure, "rate", &sample_rate); - if (ret) { - interaudiosrc->sample_rate = sample_rate; - - ret = gst_pad_set_caps (src->srcpad, caps); + if (!gst_structure_get_int (structure, "rate", &sample_rate)) { + GST_ERROR_OBJECT (src, "Audio caps without rate"); + return FALSE; } - if (gst_audio_info_from_caps (&info, caps)) { - interaudiosrc->finfo = info.finfo; + interaudiosrc->sample_rate = sample_rate; + + if (!gst_audio_info_from_caps (&info, caps)) { + GST_ERROR_OBJECT (src, "Can't parse audio caps"); + return FALSE; } + interaudiosrc->finfo = info.finfo; + + ret = gst_pad_set_caps (src->srcpad, caps); + return ret; } |