smpte: don't register transition types twice
authorMathieu Duponchelle <mathieu@centricular.com>
Tue, 10 Sep 2019 20:43:49 +0000 (22:43 +0200)
committerMathieu Duponchelle <mduponchelle1@gmail.com>
Tue, 10 Sep 2019 20:52:17 +0000 (20:52 +0000)
gst/smpte/barboxwipes.c

index 7855eaa..4f4e62e 100644 (file)
@@ -948,10 +948,16 @@ static const GstMaskDefinition definitions[] = {
 void
 _gst_barboxwipes_register (void)
 {
-  gint i = 0;
+  static gsize id = 0;
 
-  while (definitions[i].short_name) {
-    _gst_mask_register (&definitions[i]);
-    i++;
+  if (g_once_init_enter (&id)) {
+    gint i = 0;
+
+    while (definitions[i].short_name) {
+      _gst_mask_register (&definitions[i]);
+      i++;
+    }
+
+    g_once_init_leave (&id, 1);
   }
 }