Skip to content

Commit

Permalink
Use AVOnce as a static variable consistently
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Nevcairiel committed May 22, 2017
1 parent 49d0678 commit 9fb293c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libavdevice/alldevices.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion libavfilter/allfilters.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion libavformat/allformats.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 9fb293c

Please sign in to comment.