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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2240>
This commit is contained in:
Olivier Crête 2021-05-13 15:18:34 -04:00 committed by GStreamer Marge Bot
parent 8b595e7c8b
commit 761206291b

View file

@ -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);
}