Skip to content

Commit

Permalink
swresample/rematrix: fix update of channel matrix if input or output …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
t-rapp committed Feb 19, 2018
1 parent 647fa49 commit 6325bd3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libswresample/rematrix.c
Expand Up @@ -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];
Expand Down

0 comments on commit 6325bd3

Please sign in to comment.