Skip to content

Commit 9fb293c

Browse files
committed
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
1 parent 49d0678 commit 9fb293c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

libavdevice/alldevices.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static void register_all(void)
7373

7474
void avdevice_register_all(void)
7575
{
76-
AVOnce control = AV_ONCE_INIT;
76+
static AVOnce control = AV_ONCE_INIT;
7777

7878
ff_thread_once(&control, register_all);
7979
}

libavfilter/allfilters.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ static void register_all(void)
390390

391391
void avfilter_register_all(void)
392392
{
393-
AVOnce control = AV_ONCE_INIT;
393+
static AVOnce control = AV_ONCE_INIT;
394394

395395
ff_thread_once(&control, register_all);
396396
}

libavformat/allformats.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static void register_all(void)
385385

386386
void av_register_all(void)
387387
{
388-
AVOnce control = AV_ONCE_INIT;
388+
static AVOnce control = AV_ONCE_INIT;
389389

390390
ff_thread_once(&control, register_all);
391391
}

0 commit comments

Comments
 (0)