rtph265depay: minor clean-up

Declutter caps update code a bit.
This commit is contained in:
Tim-Philipp Müller 2017-06-16 12:20:34 +01:00
parent bca8ac2cf0
commit 0580efc6a6

View file

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