From f07ef2d9c9e9d1e84c532e9102594834e88a5c83 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 16 Jan 2013 14:15:57 -0500 Subject: lavr: call mix_function_init() in ff_audio_mix_set_matrix() This is needed if a custom matrix is set by the user after opening the AVAudioResampleContext because the matrix channel count can change if different mixing coefficients are used. CC:libav-stable@libav.org --- libavresample/audio_mix.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'libavresample') diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c index 12f5d24..7ed32d8 100644 --- a/libavresample/audio_mix.c +++ b/libavresample/audio_mix.c @@ -422,10 +422,6 @@ AudioMix *ff_audio_mix_alloc(AVAudioResampleContext *avr) av_free(matrix_dbl); } - ret = mix_function_init(am); - if (ret < 0) - goto error; - return am; error: @@ -704,5 +700,5 @@ int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride) return AVERROR(EINVAL); } - return 0; + return mix_function_init(am); } -- cgit v1.1 From b90632d5964d3998bab7323468a6b43ab6a24b34 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 16 Jan 2013 14:18:38 -0500 Subject: lavr: always reset mix function names and pointers in mix_function_init() CC: libav-stable@libav.org --- libavresample/audio_mix.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libavresample') diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c index 7ed32d8..c701bf1 100644 --- a/libavresample/audio_mix.c +++ b/libavresample/audio_mix.c @@ -284,11 +284,12 @@ static void mix_2_to_6_fltp_flt_c(float **samples, float **matrix, int len, static int mix_function_init(AudioMix *am) { + am->func_descr = am->func_descr_generic = "n/a"; + am->mix = am->mix_generic = NULL; + /* no need to set a mix function when we're skipping mixing */ - if (!am->in_matrix_channels || !am->out_matrix_channels) { - am->func_descr = "n/a"; + if (!am->in_matrix_channels || !am->out_matrix_channels) return 0; - } /* any-to-any C versions */ -- cgit v1.1