From e6701d51e1c7c0b33c567b50d7c3d7adf35a5823 Mon Sep 17 00:00:00 2001
From: Nicolas George <nicolas.george@normalesup.org>
Date: Wed, 28 Nov 2012 15:25:39 +0100
Subject: [PATCH] lavc/mlpdec: reset layout when channels change.

Triggered by the sample for trac ticket #1726.
---
 libavcodec/mlpdec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 753fff11ea2..c7de13c15c8 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -524,8 +524,11 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
         cp->huff_lsbs        = 24;
     }
 
-    if (substr == m->max_decoded_substream)
+    if (substr == m->max_decoded_substream &&
+        m->avctx->channels != s->max_matrix_channel + 1) {
         m->avctx->channels = s->max_matrix_channel + 1;
+        m->avctx->channel_layout = 0;
+    }
 
     return 0;
 }
-- 
GitLab