When setting the channel layout directly using AVBufferSrcParameters
the channel layout was correctly set however the init function still
expected the old string format to set the number of channels (when it
hadn't already been specified).
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
... | ... |
@@ -341,14 +341,16 @@ static av_cold int init_audio(AVFilterContext *ctx) |
341 | 341 |
return AVERROR(EINVAL); |
342 | 342 |
} |
343 | 343 |
|
344 |
- if (s->channel_layout_str) { |
|
344 |
+ if (s->channel_layout_str || s->channel_layout) { |
|
345 | 345 |
int n; |
346 | 346 |
|
347 |
- s->channel_layout = av_get_channel_layout(s->channel_layout_str); |
|
348 | 347 |
if (!s->channel_layout) { |
349 |
- av_log(ctx, AV_LOG_ERROR, "Invalid channel layout %s.\n", |
|
350 |
- s->channel_layout_str); |
|
351 |
- return AVERROR(EINVAL); |
|
348 |
+ s->channel_layout = av_get_channel_layout(s->channel_layout_str); |
|
349 |
+ if (!s->channel_layout) { |
|
350 |
+ av_log(ctx, AV_LOG_ERROR, "Invalid channel layout %s.\n", |
|
351 |
+ s->channel_layout_str); |
|
352 |
+ return AVERROR(EINVAL); |
|
353 |
+ } |
|
352 | 354 |
} |
353 | 355 |
n = av_get_channel_layout_nb_channels(s->channel_layout); |
354 | 356 |
if (s->channels) { |