aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2017-05-22 12:00:23 +0200
committerHendrik Leppkes <h.leppkes@gmail.com>2017-05-22 12:36:52 +0200
commit8640339dbbb50a4031b71d092dad29fa036f4266 (patch)
treee54a7f18f65a7f5c27452dcb0ab0baf7ab71340f
parent7fae0ea21daa6d8e391cbffb08f66c0b4509ddd6 (diff)
downloadffmpeg-8640339dbbb50a4031b71d092dad29fa036f4266.tar.gz
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
-rw-r--r--libavdevice/alldevices.c2
-rw-r--r--libavfilter/allfilters.c2
-rw-r--r--libavformat/allformats.c2
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 ec6ec048e8..ba0949943a 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -381,7 +381,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 09e62c3cfc..3e014c6063 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -384,7 +384,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);
}