summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2018-02-21 19:59:04 +0100
committerMathieu Duponchelle <mathieu@centricular.com>2018-02-21 19:59:04 +0100
commit359b0a86f18803f9d436f658822b8bddad27f7b3 (patch)
tree0e167ef6566e05ac4e8fc286e75f0bb2da78c0c6
parentc8f442deb0ce02fe90eeb5c30b099450a512b1fa (diff)
rtpptdemux: do no assume sink caps are non NULL
-rw-r--r--gst/rtpmanager/gstrtpptdemux.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/gst/rtpmanager/gstrtpptdemux.c b/gst/rtpmanager/gstrtpptdemux.c
index 7a7fc6ef5..562f16217 100644
--- a/gst/rtpmanager/gstrtpptdemux.c
+++ b/gst/rtpmanager/gstrtpptdemux.c
@@ -325,22 +325,25 @@ gst_rtp_pt_demux_get_caps (GstRtpPtDemux * rtpdemux, guint pt)
g_value_unset (&ret);
sink_caps = gst_pad_get_current_caps (rtpdemux->sink);
- if (caps == NULL) {
- caps = gst_caps_ref (sink_caps);
- } else {
- GstStructure *s1;
- GstStructure *s2;
- guint ssrc;
- caps = gst_caps_make_writable (caps);
- s1 = gst_caps_get_structure (sink_caps, 0);
- s2 = gst_caps_get_structure (caps, 0);
+ if (sink_caps) {
+ if (caps == NULL) {
+ caps = gst_caps_ref (sink_caps);
+ } else {
+ GstStructure *s1;
+ GstStructure *s2;
+ guint ssrc;
- gst_structure_get_uint (s1, "ssrc", &ssrc);
- gst_structure_set (s2, "ssrc", G_TYPE_UINT, ssrc, NULL);
- }
+ caps = gst_caps_make_writable (caps);
+ s1 = gst_caps_get_structure (sink_caps, 0);
+ s2 = gst_caps_get_structure (caps, 0);
- gst_caps_unref (sink_caps);
+ gst_structure_get_uint (s1, "ssrc", &ssrc);
+ gst_structure_set (s2, "ssrc", G_TYPE_UINT, ssrc, NULL);
+ }
+
+ gst_caps_unref (sink_caps);
+ }
GST_DEBUG ("pt %d, got caps %" GST_PTR_FORMAT, pt, caps);