summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-08-24 23:03:45 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-09 13:46:58 +0200
commitbff1d0c6587243369f12c575f5dcb20d6e7e910b (patch)
tree58d1870677021c186fa6efdc7d094bdb67d089f0 /libavfilter
parent71daaafa3a7f0e3494b73055bdbb3fd8aa114173 (diff)
avfilter/af_headphone: Avoid duplicating string needlessly
The string given by an AVOption that contains the channel assignment is used only once; ergo it doesn't matter that parsing the string via av_strtok() is destructive. There is no need to make a copy. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/af_headphone.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
index 32939af854..967f8ed5a6 100644
--- a/libavfilter/af_headphone.c
+++ b/libavfilter/af_headphone.c
@@ -100,16 +100,13 @@ static int parse_channel_name(const char *arg, uint64_t *rchannel)
static void parse_map(AVFilterContext *ctx)
{
HeadphoneContext *s = ctx->priv;
- char *arg, *tokenizer, *p, *args = av_strdup(s->map);
+ char *arg, *tokenizer, *p;
uint64_t used_channels = 0;
- if (!args)
- return;
- p = args;
-
s->lfe_channel = -1;
s->nb_inputs = 1;
+ p = s->map;
while ((arg = av_strtok(p, "|", &tokenizer))) {
uint64_t out_channel;
@@ -133,8 +130,6 @@ static void parse_map(AVFilterContext *ctx)
s->nb_inputs = 2;
else
s->nb_inputs = s->nb_irs + 1;
-
- av_free(args);
}
typedef struct ThreadData {