Skip to content

vabasedec: refactor format and capsfeature selection

This is a simplification of the venerable gst_va_base_dec_get_preferred_format_and_caps_features() function, which predates since gstreamer-vaapi. It's used to select the format and the capsfeature to use when setting the output state. It was complex and hard to follow. This refactor simplifies a lot the algorithm.

The first thing to remove _downstream_has_video_meta() since, most of the time it will be called before the caps negotiation, and allocation queries make sense only after caps negotiation. It might work during renegotiation but, in that case, caps feature change is uncommon. Better a simple and common approach.

Also, for performance, instead of dealing with caps features as strings, GQuarks are used.

The refactor works like this:

  1. If peer pad returns any caps, the returned caps feature is system memory and looks for a proper format in the allowed caps.

  2. The allowed caps are traversed at most 3 times: one per each valid caps feature. First VAMemory, later DMABuf, and last system memory. The first to match in allowed caps is picked, and the first format matching with the chroma is picked too.

Notice that, right now, using playbin videoconvert never return any.

Merge request reports