Ticket #5897: fix_swr_set_matrix.patch

File fix_swr_set_matrix.patch, 1.3 KB (added by v0lt, 10 years ago)
  • libswresample/rematrix.c

    From 55a5ec258f53fc7a4bdbea200d096bd5d46625d4 Mon Sep 17 00:00:00 2001
    From: Aleksoid1978
    Date: Wed, 19 Oct 2016 11:38:12 +0300
    Subject: [PATCH] fix swr_set_matrix()
    
    ---
     libswresample/rematrix.c | 6 ++----
     1 file changed, 2 insertions(+), 4 deletions(-)
    
    diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
    index 1af2498..4721063 100644
    a b int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)  
    6868    if (!s || s->in_convert) // s needs to be allocated but not initialized
    6969        return AVERROR(EINVAL);
    7070    memset(s->matrix, 0, sizeof(s->matrix));
     71    memset(s->matrix_flt, 0, sizeof(s->matrix_flt));
    7172    nb_in  = av_get_channel_layout_nb_channels(s->user_in_ch_layout);
    7273    nb_out = av_get_channel_layout_nb_channels(s->user_out_ch_layout);
    7374    for (out = 0; out < nb_out; out++) {
    7475        for (in = 0; in < nb_in; in++)
    75             s->matrix[out][in] = matrix[in];
    76         if (s->int_sample_fmt == AV_SAMPLE_FMT_FLTP)
    77             for (in = 0; in < nb_in; in++)
    78                 s->matrix_flt[out][in] = matrix[in];
     76            s->matrix_flt[out][in] = s->matrix[out][in] = matrix[in];
    7977        matrix += stride;
    8078    }
    8179    s->rematrix_custom = 1;