From 9f798776e5756deadeb96153a24eb806f710f8b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 1 Mar 2022 20:59:30 +0200 Subject: [PATCH] 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: --- .../gst-plugins-good/gst/matroska/matroska-mux.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c b/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c index bf172b44f4..e0d2a46545 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c @@ -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.