From 44f70445b67e13ddac4fa688a40896beb1e4b4a3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 2 Jun 2017 20:54:20 +0100 Subject: [PATCH] rtph264depay: minor clean-up Declutter caps update code a bit. --- gst/rtp/gstrtph264depay.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c index 93f4f76..2539387 100644 --- a/gst/rtp/gstrtph264depay.c +++ b/gst/rtp/gstrtph264depay.c @@ -265,9 +265,10 @@ parse_pps (GstMapInfo * map, guint32 * sps_id, guint32 * pps_id) static gboolean gst_rtp_h264_set_src_caps (GstRtpH264Depay * rtph264depay) { - gboolean res; + gboolean res, update_caps; GstCaps *srccaps; GstCaps *old_caps; + GstPad *srcpad; if (!rtph264depay->byte_stream && (!rtph264depay->new_codec_data || @@ -396,9 +397,9 @@ gst_rtp_h264_set_src_caps (GstRtpH264Depay * rtph264depay) } } + srcpad = GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay); - old_caps = - gst_pad_get_current_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay)); + old_caps = gst_pad_get_current_caps (srcpad); if (old_caps != NULL) { /* Only update the caps if they are not equal. For @@ -406,12 +407,7 @@ gst_rtp_h264_set_src_caps (GstRtpH264Depay * rtph264depay) * changes. This is the same behaviour as in h264parse */ if (rtph264depay->byte_stream) { - if (!gst_caps_is_equal (srccaps, old_caps)) - res = - gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay), - 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; @@ -422,20 +418,19 @@ gst_rtp_h264_set_src_caps (GstRtpH264Depay * rtph264depay) 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 (rtph264depay), - 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 (rtph264depay), - srccaps); + update_caps = TRUE; + } + + if (update_caps) { + res = gst_pad_set_caps (srcpad, srccaps); + } else { + res = TRUE; } gst_caps_unref (srccaps); -- 2.7.4