diff mbox

[FFmpeg-devel,1/2] swresample/rematrix: fix update of channel matrix if input or output layout is undefined

Message ID 1518683696-17786-1-git-send-email-t.rapp@noa-archive.com
State Accepted
Commit 6325bd3717348615adafb52e4da2fd01a3007d0a
Headers show

Commit Message

Tobias Rapp Feb. 15, 2018, 8:34 a.m. UTC
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>
---
 libswresample/rematrix.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Feb. 16, 2018, 8:52 p.m. UTC | #1
On Thu, Feb 15, 2018 at 09:34:55AM +0100, Tobias Rapp wrote:
> 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>
> ---
>  libswresample/rematrix.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

LGTM

thx

[...]
Tobias Rapp Feb. 19, 2018, 7:35 a.m. UTC | #2
On 16.02.2018 21:52, Michael Niedermayer wrote:
> On Thu, Feb 15, 2018 at 09:34:55AM +0100, Tobias Rapp wrote:
>> 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>
>> ---
>>   libswresample/rematrix.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> LGTM

Applied, thanks for review.

Regards,
Tobias
diff mbox

Patch

diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 9fcfff1..8227730 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];