mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:36:20 +00:00
x264enc: fix crash on NULL caps when negotiation happens without a downstream peer
gst-launch-1.0 videotestsrc ! x264enc
This commit is contained in:
parent
8c1be8796e
commit
20d6dbd2f6
1 changed files with 6 additions and 0 deletions
|
@ -1552,6 +1552,10 @@ gst_x264_enc_set_profile_and_level (GstX264Enc * encoder, GstCaps * caps)
|
||||||
profile = gst_structure_get_string (s, "profile");
|
profile = gst_structure_get_string (s, "profile");
|
||||||
|
|
||||||
allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder));
|
allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder));
|
||||||
|
|
||||||
|
if (allowed_caps == NULL)
|
||||||
|
goto no_peer;
|
||||||
|
|
||||||
if (!gst_caps_can_intersect (allowed_caps, caps)) {
|
if (!gst_caps_can_intersect (allowed_caps, caps)) {
|
||||||
allowed_caps = gst_caps_make_writable (allowed_caps);
|
allowed_caps = gst_caps_make_writable (allowed_caps);
|
||||||
allowed_caps = gst_caps_truncate (allowed_caps);
|
allowed_caps = gst_caps_truncate (allowed_caps);
|
||||||
|
@ -1581,6 +1585,8 @@ gst_x264_enc_set_profile_and_level (GstX264Enc * encoder, GstCaps * caps)
|
||||||
}
|
}
|
||||||
gst_caps_unref (allowed_caps);
|
gst_caps_unref (allowed_caps);
|
||||||
|
|
||||||
|
no_peer:
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue