summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-06-02 20:54:20 +0100
committerTim-Philipp Müller <tim@centricular.com>2017-11-23 09:27:22 +0100
commit44f70445b67e13ddac4fa688a40896beb1e4b4a3 (patch)
treea40b4ef74d84a827b9b1da0f235fc60fedc4103c /gst
parent22ab222dbca65da4ae32481fa20f11ef383d16dd (diff)
rtph264depay: minor clean-up
Declutter caps update code a bit.
Diffstat (limited to 'gst')
-rw-r--r--gst/rtp/gstrtph264depay.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c
index 93f4f76ba..2539387b9 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);