diff options
author | Tobias Rapp <t.rapp@noa-archive.com> | 2018-02-14 17:01:08 +0100 |
---|---|---|
committer | Tobias Rapp <t.rapp@noa-archive.com> | 2018-02-19 10:09:15 +0100 |
commit | 1c3144751a8235ce5abd463d31f20dac4e73c6b7 (patch) | |
tree | 048c46a7dae49c1146ab04d9d3da96d516831464 /libswresample | |
parent | 028a032a315a0d8b6f9344f461dade47d5536e89 (diff) | |
download | ffmpeg-1c3144751a8235ce5abd463d31f20dac4e73c6b7.tar.gz |
swresample/rematrix: fix update of channel matrix if input or output layout is undefined
Prefer direct in/out channel count values over channel layout, when
available. Fixes a pan filter bug (ticket #6790).
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
(cherry picked from commit 6325bd3717348615adafb52e4da2fd01a3007d0a)
Diffstat (limited to 'libswresample')
-rw-r--r-- | libswresample/rematrix.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index 4721063a13..636c2f3b8b 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -69,8 +69,10 @@ int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride) return AVERROR(EINVAL); memset(s->matrix, 0, sizeof(s->matrix)); memset(s->matrix_flt, 0, sizeof(s->matrix_flt)); - nb_in = av_get_channel_layout_nb_channels(s->user_in_ch_layout); - nb_out = av_get_channel_layout_nb_channels(s->user_out_ch_layout); + nb_in = (s->user_in_ch_count > 0) ? s->user_in_ch_count : + av_get_channel_layout_nb_channels(s->user_in_ch_layout); + nb_out = (s->user_out_ch_count > 0) ? s->user_out_ch_count : + av_get_channel_layout_nb_channels(s->user_out_ch_layout); for (out = 0; out < nb_out; out++) { for (in = 0; in < nb_in; in++) s->matrix_flt[out][in] = s->matrix[out][in] = matrix[in]; |