Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit 9da84b3

Browse files
committed
fix concurrent writer registration, fixes #324
1 parent 639dbb3 commit 9da84b3

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

android/app/src/main/cpp/fftools_ffprobe.c

+2-7
Original file line numberDiff line numberDiff line change
@@ -886,10 +886,10 @@ static void writer_print_integers(WriterContext *wctx, const char *name,
886886

887887
__thread const Writer *registered_writers[MAX_REGISTERED_WRITERS_NB + 1];
888888

889+
__thread int next_registered_writer_idx = 0;
890+
889891
static int writer_register(const Writer *writer)
890892
{
891-
static int next_registered_writer_idx = 0;
892-
893893
if (next_registered_writer_idx == MAX_REGISTERED_WRITERS_NB)
894894
return AVERROR(ENOMEM);
895895

@@ -1798,11 +1798,6 @@ static Writer xml_writer = {
17981798

17991799
static void writer_register_all(void)
18001800
{
1801-
static int initialized;
1802-
1803-
if (initialized)
1804-
return;
1805-
initialized = 1;
18061801

18071802
writer_register(&default_writer);
18081803
writer_register(&compact_writer);

ios/src/fftools_ffprobe.c

+2-7
Original file line numberDiff line numberDiff line change
@@ -886,10 +886,10 @@ static void writer_print_integers(WriterContext *wctx, const char *name,
886886

887887
__thread const Writer *registered_writers[MAX_REGISTERED_WRITERS_NB + 1];
888888

889+
__thread int next_registered_writer_idx = 0;
890+
889891
static int writer_register(const Writer *writer)
890892
{
891-
static int next_registered_writer_idx = 0;
892-
893893
if (next_registered_writer_idx == MAX_REGISTERED_WRITERS_NB)
894894
return AVERROR(ENOMEM);
895895

@@ -1798,11 +1798,6 @@ static Writer xml_writer = {
17981798

17991799
static void writer_register_all(void)
18001800
{
1801-
static int initialized;
1802-
1803-
if (initialized)
1804-
return;
1805-
initialized = 1;
18061801

18071802
writer_register(&default_writer);
18081803
writer_register(&compact_writer);

0 commit comments

Comments
 (0)