summaryrefslogtreecommitdiff
path: root/avplay.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-05-03 18:57:02 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-05-07 12:42:32 -0400
commit85e5b866dca776ba259113604c56136c2c8531b3 (patch)
tree25da9a007c66b86e0fde46f562ac7eb7444c674c /avplay.c
parentf1322480288e13110a209cadbd698f568b407b4f (diff)
avplay: properly close/reopen AVAudioResampleContext on channel layout change
fixes Bug#280
Diffstat (limited to 'avplay.c')
-rw-r--r--avplay.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/avplay.c b/avplay.c
index e18b2e46f2..9bd83f381e 100644
--- a/avplay.c
+++ b/avplay.c
@@ -2060,15 +2060,17 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
dec->channel_layout != is->resample_channel_layout;
if ((!is->avr && audio_resample) || resample_changed) {
+ int ret;
if (is->avr)
avresample_close(is->avr);
else if (audio_resample) {
- int ret;
is->avr = avresample_alloc_context();
if (!is->avr) {
fprintf(stderr, "error allocating AVAudioResampleContext\n");
break;
}
+ }
+ if (audio_resample) {
av_opt_set_int(is->avr, "in_channel_layout", dec->channel_layout, 0);
av_opt_set_int(is->avr, "in_sample_fmt", dec->sample_fmt, 0);
av_opt_set_int(is->avr, "in_sample_rate", dec->sample_rate, 0);