mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
meta: do metadata registration threadsafe
We need to use g_once to register the metadata implementations only once. See https://bugzilla.gnome.org/show_bug.cgi?id=685332
This commit is contained in:
parent
10c8586902
commit
ed19974e25
3 changed files with 9 additions and 6 deletions
|
@ -453,13 +453,14 @@ my_example_meta_get_info (void)
|
|||
{
|
||||
static const GstMetaInfo *meta_info = NULL;
|
||||
|
||||
if (meta_info == NULL) {
|
||||
meta_info = gst_meta_register (MY_EXAMPLE_META_API_TYPE,
|
||||
if (g_once_init_enter (&meta_info)) {
|
||||
const GstMetaInfo *mi = gst_meta_register (MY_EXAMPLE_META_API_TYPE,
|
||||
"MyExampleMeta",
|
||||
sizeof (MyExampleMeta),
|
||||
my_example_meta_init,
|
||||
my_example_meta_free,
|
||||
my_example_meta_transform);
|
||||
g_once_init_leave (&meta_info, mi);
|
||||
}
|
||||
return meta_info;
|
||||
}
|
||||
|
|
|
@ -82,12 +82,13 @@ gst_net_address_meta_get_info (void)
|
|||
{
|
||||
static const GstMetaInfo *meta_info = NULL;
|
||||
|
||||
if (meta_info == NULL) {
|
||||
meta_info = gst_meta_register (GST_NET_ADDRESS_META_API_TYPE,
|
||||
if (g_once_init_enter (&meta_info)) {
|
||||
const GstMetaInfo *mi = gst_meta_register (GST_NET_ADDRESS_META_API_TYPE,
|
||||
"GstNetAddressMeta",
|
||||
sizeof (GstNetAddressMeta),
|
||||
net_address_meta_init,
|
||||
net_address_meta_free, net_address_meta_transform);
|
||||
g_once_init_leave (&meta_info, mi);
|
||||
}
|
||||
return meta_info;
|
||||
}
|
||||
|
|
|
@ -139,11 +139,12 @@ gst_meta_test_get_info (void)
|
|||
{
|
||||
static const GstMetaInfo *meta_test_info = NULL;
|
||||
|
||||
if (meta_test_info == NULL) {
|
||||
meta_test_info = gst_meta_register (GST_META_TEST_API_TYPE,
|
||||
if (g_once_init_enter (&meta_test_info)) {
|
||||
const GstMetaInfo *mi = gst_meta_register (GST_META_TEST_API_TYPE,
|
||||
"GstMetaTest",
|
||||
sizeof (GstMetaTest),
|
||||
test_init_func, test_free_func, test_transform_func);
|
||||
g_once_init_leave (&meta_test_info, mi);
|
||||
}
|
||||
return meta_test_info;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue