[FFmpeg-cvslog] Use AVOnce as a static variable consistently

Hendrik Leppkes git at videolan.org
Mon May 22 13:39:39 EEST 2017


ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Mon May 22 12:00:23 2017 +0200| [9fb293cfd8b758b98f1f535a2867c7bf3a324af6] | committer: Hendrik Leppkes

Use AVOnce as a static variable consistently

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9fb293cfd8b758b98f1f535a2867c7bf3a324af6
---

 libavdevice/alldevices.c | 2 +-
 libavfilter/allfilters.c | 2 +-
 libavformat/allformats.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index 280a260bd3..a8ed53ae5d 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -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);
 }
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 2bcfce77be..f8cd193dbe 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -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);
 }
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 62661d14a4..b3ffe0f2b6 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -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);
 }



More information about the ffmpeg-cvslog mailing list