matroska-mux: Handle pixel-aspect-ratio caps field correctly when checking caps equality

Not having this field is equivalent with it being 1/1 so consider
it like that. The generic caps functions are not aware of these
semantics and would consider the caps different, causing a negotiation
failure when caps are changing from caps with to caps without or the
other way around.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1826>
This commit is contained in:
Sebastian Dröge 2022-03-01 20:59:30 +02:00 committed by GStreamer Marge Bot
parent 1b851ae23f
commit 9f798776e5

View file

@ -1019,6 +1019,18 @@ check_field (GQuark field_id, const GValue * value, gpointer user_data)
else if (field_id == g_quark_from_static_string ("bit-depth-luma"))
return FALSE;
/* Remove pixel-aspect-ratio field if it contains 1/1 as that's considered
* equivalent to not having the field but are not considered equivalent
* by the generic caps functions
*/
if (field_id == g_quark_from_static_string ("pixel-aspect-ratio")) {
gint par_n = gst_value_get_fraction_numerator (value);
gint par_d = gst_value_get_fraction_denominator (value);
if (par_n == 1 && par_d == 1)
return FALSE;
}
/* Remove multiview-mode=mono and multiview-flags=0 fields as those are
* equivalent with not having the fields but are not considered equivalent
* by the generic caps functions.