rtph264depay: minor clean-up

Declutter caps update code a bit.
This commit is contained in:
Tim-Philipp Müller 2017-06-02 20:54:20 +01:00
parent 22ab222dbc
commit 44f70445b6

View file

@ -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);