aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Rapp <t.rapp@noa-archive.com>2018-02-14 17:01:08 +0100
committerTobias Rapp <t.rapp@noa-archive.com>2018-02-20 10:08:05 +0100
commit8ae9bbef87f89f7ea0633b86bf0cadf243bc488f (patch)
tree825489ec1bb01f98a49d1de91b58e5e949c2ac76
parent9f14908a96ca13b7bad900c65d82f1404fa4fb89 (diff)
downloadffmpeg-8ae9bbef87f89f7ea0633b86bf0cadf243bc488f.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)
-rw-r--r--libswresample/rematrix.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index ddba0433e8..7ab74edd05 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -68,8 +68,10 @@ int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)
if (!s || s->in_convert) // s needs to be allocated but not initialized
return AVERROR(EINVAL);
memset(s->matrix, 0, sizeof(s->matrix));
- 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[out][in] = matrix[in];