From 0580efc6a6d37b09bbcb2d27c504a0d8a171d6e2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 16 Jun 2017 12:20:34 +0100 Subject: [PATCH] rtph265depay: minor clean-up Declutter caps update code a bit. --- gst/rtp/gstrtph265depay.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/gst/rtp/gstrtph265depay.c b/gst/rtp/gstrtph265depay.c index ce62777..c6545c0 100644 --- a/gst/rtp/gstrtph265depay.c +++ b/gst/rtp/gstrtph265depay.c @@ -296,9 +296,10 @@ parse_pps (GstMapInfo * map, guint32 * sps_id, guint32 * pps_id) static gboolean gst_rtp_h265_set_src_caps (GstRtpH265Depay * rtph265depay) { - gboolean res; + gboolean res, update_caps; GstCaps *old_caps; GstCaps *srccaps; + GstPad *srcpad; if (!rtph265depay->byte_stream && (!rtph265depay->new_codec_data || @@ -506,8 +507,9 @@ gst_rtp_h265_set_src_caps (GstRtpH265Depay * rtph265depay) gst_buffer_unref (codec_data); } - old_caps = - gst_pad_get_current_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay)); + srcpad = GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay); + + old_caps = gst_pad_get_current_caps (srcpad); if (old_caps != NULL) { /* Only update the caps if they are not equal. For @@ -516,12 +518,7 @@ gst_rtp_h265_set_src_caps (GstRtpH265Depay * rtph265depay) * and gstrtph264depay */ if (rtph265depay->byte_stream) { - if (!gst_caps_is_equal (srccaps, old_caps)) - res = - gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay), - srccaps); - else - res = TRUE; + update_caps = !gst_caps_is_equal (srccaps, old_caps); } else { GstCaps *tmp_caps = gst_caps_copy (srccaps); GstStructure *old_s, *tmp_s; @@ -532,20 +529,18 @@ gst_rtp_h265_set_src_caps (GstRtpH265Depay * rtph265depay) gst_structure_set_value (tmp_s, "codec_data", gst_structure_get_value (old_s, "codec_data")); - if (!gst_caps_is_equal (old_caps, tmp_caps)) - res = - gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay), - srccaps); - else - res = TRUE; - + update_caps = !gst_caps_is_equal (old_caps, tmp_caps); gst_caps_unref (tmp_caps); } gst_caps_unref (old_caps); } else { - res = - gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay), - srccaps); + update_caps = TRUE; + } + + if (update_caps) { + res = gst_pad_set_caps (srcpad, srccaps); + } else { + res = TRUE; } gst_caps_unref (srccaps); -- 2.7.4