1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-19 05:49:09 +02:00

avfilter/formats: Avoid redundant counter

The ff_set_common_(formats|channel_layouts|samplerates) have to free
their list in case it doesn't have an owner; therefore they tracked
whether they attached it to an owner. But the list's refcount already
contains such a counter, so we don't have to keep track of whether we
have attached the list to an owner.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-08-15 09:44:59 +02:00
parent e88db774d8
commit 79595024ed

View File

@ -623,7 +623,7 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
}
#define SET_COMMON_FORMATS(ctx, fmts, ref_fn, unref_fn) \
int count = 0, i; \
int i; \
\
if (!fmts) \
return AVERROR(ENOMEM); \
@ -634,7 +634,6 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
if (ret < 0) { \
return ret; \
} \
count++; \
} \
} \
for (i = 0; i < ctx->nb_outputs; i++) { \
@ -643,13 +642,11 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
if (ret < 0) { \
return ret; \
} \
count++; \
} \
} \
\
if (!count) { \
if (!fmts->refcount) \
unref_fn(&fmts); \
} \
\
return 0;