gst: Ensure possible_caps exists before comparing caps

During negotiation, ensure that possible_caps exists before calling
gst_caps_intersect_full(). Sometimes possible_caps seem to be NULL which
cause the GST_IS_CAPS assert to fail.

The reason for the occasional NULL possible_caps during initial
negotiation is unknown, but this is also possible during renegotiation.
The handle_format_change() may be triggered before the next create(),
win which case we have not yet discovered in the streaming thread that
we are in the NOT_NEGOTIATED state. We should guard against this
possibility as well.
This commit is contained in:
Olle Axelsson 2024-12-12 12:17:26 +01:00 committed by Arun Raghavan
parent dea6fa7f4c
commit 1cc00923db

View file

@ -1064,7 +1064,7 @@ handle_format_change (GstPipeWireSrc *pwsrc,
}
pw_peer_caps = gst_caps_from_format (param);
if (pw_peer_caps) {
if (pw_peer_caps && pwsrc->possible_caps) {
pwsrc->caps = gst_caps_intersect_full (pw_peer_caps,
pwsrc->possible_caps,
GST_CAPS_INTERSECT_FIRST);