gst: src: Improve DMA_DRM caps selection

The translation between Pipewire parameters and Gstreamer caps is,
for compatibility reasons, ambiguous. Formats with linear modifier
are translated both in the legacy way as `format`, as well as
`drm-format`.

When finishing negotiation and setting caps, ensure that we:
1. set caps that the peer actually supports in order to prevent
   negotiation errors.
2. fixate caps to DMA_DRM if both options are supported, using the newly
   introduced helper, in order to prevent hangs.

While on it, add some small clean-ups that hopefully make the code
easier to follow, notably that `pwsrc->caps` and `pwsrc->possible_caps`
are only used during negotiation.
This commit is contained in:
Robert Mader 2024-05-28 16:59:01 +02:00
parent 05b1c9d0c8
commit e6f2aa6ce0
2 changed files with 19 additions and 5 deletions

View file

@ -55,6 +55,7 @@ struct _GstPipeWireSrc {
gboolean autoconnect;
GstCaps *caps;
GstCaps *possible_caps;
gboolean is_video;
GstVideoInfo video_info;