[2/2] avplay: Get the default channel layout before deciding whether to resample

Message ID 1347004640-32636-2-git-send-email-martin@martin.st
State New
Headers show

Commit Message

Martin Storsjö Sept. 7, 2012, 7:57 a.m.
The default channel layout is guessed at startup, but this is
required if the demuxer/decoder resets the channel layout back
to 0/unknown regularly.
---
 avplay.c |    2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/avplay.c b/avplay.c
index 0c642e0..6f8f2cb 100644
--- a/avplay.c
+++ b/avplay.c
@@ -1916,6 +1916,8 @@  static int audio_decode_frame(VideoState *is, double *pts_ptr)
                                                    is->frame->nb_samples,
                                                    dec->sample_fmt, 1);
 
+            if (!dec->channel_layout)
+                dec->channel_layout = av_get_default_channel_layout(dec->channels);
             audio_resample = dec->sample_fmt     != is->sdl_sample_fmt ||
                              dec->channel_layout != is->sdl_channel_layout;