From 761206291bee52d969c536baba00ef54dc970db9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Thu, 13 May 2021 15:18:34 -0400 Subject: [PATCH] openh264: Don't use GOnce for ABI check It turns out the value used for g_once_* APIs can't be zero. And this is a very cheap check, so let's just do it every time. Part-of: --- ext/openh264/gstopenh264element.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/ext/openh264/gstopenh264element.c b/ext/openh264/gstopenh264element.c index 5d8f9d3..3c5c378 100644 --- a/ext/openh264/gstopenh264element.c +++ b/ext/openh264/gstopenh264element.c @@ -37,20 +37,12 @@ gboolean openh264_element_init (GstPlugin * plugin) { - static gsize res = FALSE; - - if (g_once_init_enter (&res)) { - gsize value; - OpenH264Version libver; - /* g_stCodecVersion is the version detected at build time as defined in the - * headers and WelsGetCodecVersion() is the version detected at runtime. - * This is a safeguard to avoid crashes since OpenH264 has been changing - * ABI without changing the SONAME. - */ - libver = WelsGetCodecVersion (); - value = memcmp (&libver, &g_stCodecVersion, sizeof (libver)) == 0; - g_once_init_leave (&res, value); - } - - return res; + OpenH264Version libver; + /* g_stCodecVersion is the version detected at build time as defined in the + * headers and WelsGetCodecVersion() is the version detected at runtime. + * This is a safeguard to avoid crashes since OpenH264 has been changing + * ABI without changing the SONAME. + */ + libver = WelsGetCodecVersion (); + return (memcmp (&libver, &g_stCodecVersion, sizeof (libver)) == 0); } -- 2.7.4