gst: Sanitize caps before translating

DMABuf caps without concrete formats and modifiers don't map well to the
Pipewire negotiation process.
Introduce a new gst_caps_sanitize() helper function, where such cases
can be handled.
This commit is contained in:
Robert Mader 2024-02-25 17:36:08 +01:00
parent f1b75fc6f8
commit 8a271a87b7
3 changed files with 47 additions and 1 deletions

View file

@ -844,10 +844,14 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc)
/* no peer, work with our own caps then */
caps = thiscaps;
}
GST_DEBUG_OBJECT (basesrc, "have common caps: %" GST_PTR_FORMAT, caps);
gst_caps_sanitize (caps);
if (caps == NULL || gst_caps_is_empty (caps))
goto no_common_caps;
GST_DEBUG_OBJECT (basesrc, "have common caps: %" GST_PTR_FORMAT, caps);
GST_DEBUG_OBJECT (basesrc, "have common caps (sanitized): %" GST_PTR_FORMAT, caps);
/* open a connection with these caps */
possible = gst_caps_to_format_all (caps);