]> git.sesse.net Git - ffmpeg/commitdiff
Use AVOnce as a static variable consistently
authorHendrik Leppkes <h.leppkes@gmail.com>
Mon, 22 May 2017 10:00:23 +0000 (12:00 +0200)
committerHendrik Leppkes <h.leppkes@gmail.com>
Mon, 22 May 2017 10:36:32 +0000 (12:36 +0200)
Using AVOnce as a stack variable makes no sense as the state is lost
when the function exits.

This fixes repeated calls to av(filter/device)_register_all

libavdevice/alldevices.c
libavfilter/allfilters.c
libavformat/allformats.c

index 280a260bd39b1687778f51e11e8aa35c7c05f369..a8ed53ae5deb3273cc6f5b1d525a66f94144f37f 100644 (file)
@@ -73,7 +73,7 @@ static void register_all(void)
 
 void avdevice_register_all(void)
 {
-    AVOnce control = AV_ONCE_INIT;
+    static AVOnce control = AV_ONCE_INIT;
 
     ff_thread_once(&control, register_all);
 }
index 2bcfce77bef055ad0e5d993e5cb3ddd9da7f62c3..f8cd193dbebc6fd3de0b7bfe41095b28f59b4122 100644 (file)
@@ -390,7 +390,7 @@ static void register_all(void)
 
 void avfilter_register_all(void)
 {
-    AVOnce control = AV_ONCE_INIT;
+    static AVOnce control = AV_ONCE_INIT;
 
     ff_thread_once(&control, register_all);
 }
index 62661d14a44d6e011a3f08207c127309535e4595..b3ffe0f2b68c39287f26f4f7b5e876421b8fd646 100644 (file)
@@ -385,7 +385,7 @@ static void register_all(void)
 
 void av_register_all(void)
 {
-    AVOnce control = AV_ONCE_INIT;
+    static AVOnce control = AV_ONCE_INIT;
 
     ff_thread_once(&control, register_all);
 }