summaryrefslogtreecommitdiff
path: root/libavfilter/formats.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-08-15 09:44:59 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-08-20 14:30:17 +0200
commit79595024ed887e2f473ec21ad3596af2c3fc4041 (patch)
tree7bbf8dda5a84e08ed812b36eb6ff019158371849 /libavfilter/formats.c
parente88db774d8c3905fc664446914202f66ebc1a140 (diff)
downloadffmpeg-79595024ed887e2f473ec21ad3596af2c3fc4041.tar.gz
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>
Diffstat (limited to 'libavfilter/formats.c')
-rw-r--r--libavfilter/formats.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index ca85b4094b..8a92ff0d57 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -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;