summaryrefslogtreecommitdiff
path: root/libavresample
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-17 14:06:06 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-17 14:06:11 +0100
commit8d07bbca6360a938c607dab4dcb333e12f3d915b (patch)
tree9f253cc9866c746732ab2d07edb4d87b25e3799c /libavresample
parent021b3497e1bccd4d6b2e54ecf89cfd43793a2489 (diff)
parentf322b2073581119de5da74f92a03309a36891cfa (diff)
Merge commit 'f322b2073581119de5da74f92a03309a36891cfa'
* commit 'f322b2073581119de5da74f92a03309a36891cfa': lavr: only save/restore the mixing matrix if mixing is being done rtpdec_vp8: Cosmetics: Fix bad alignment/indentation rtpenc: Allow including a SDES/CNAME block in RTCP SR packets Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavresample')
-rw-r--r--libavresample/resample.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libavresample/resample.c b/libavresample/resample.c
index 381d673717..15eaa50e23 100644
--- a/libavresample/resample.c
+++ b/libavresample/resample.c
@@ -259,6 +259,7 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
AVAudioResampleContext and force resampling */
if (!avr->resample_needed) {
int fifo_samples;
+ int restore_matrix = 0;
double matrix[AVRESAMPLE_MAX_CHANNELS * AVRESAMPLE_MAX_CHANNELS] = { 0 };
/* buffer any remaining samples in the output FIFO before closing */
@@ -274,9 +275,12 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
goto reinit_fail;
}
/* save the channel mixing matrix */
- ret = avresample_get_matrix(avr, matrix, AVRESAMPLE_MAX_CHANNELS);
- if (ret < 0)
- goto reinit_fail;
+ if (avr->am) {
+ ret = avresample_get_matrix(avr, matrix, AVRESAMPLE_MAX_CHANNELS);
+ if (ret < 0)
+ goto reinit_fail;
+ restore_matrix = 1;
+ }
/* close the AVAudioResampleContext */
avresample_close(avr);
@@ -284,9 +288,11 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
avr->force_resampling = 1;
/* restore the channel mixing matrix */
- ret = avresample_set_matrix(avr, matrix, AVRESAMPLE_MAX_CHANNELS);
- if (ret < 0)
- goto reinit_fail;
+ if (restore_matrix) {
+ ret = avresample_set_matrix(avr, matrix, AVRESAMPLE_MAX_CHANNELS);
+ if (ret < 0)
+ goto reinit_fail;
+ }
/* re-open the AVAudioResampleContext */
ret = avresample_open(avr);