From: Anton Khirnov <an...@khirnov.net>

Signed-off-by: James Almer <jamr...@gmail.com>
---
 libavcodec/shorten.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index fde5c4b982..6cce675c9f 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -428,7 +428,11 @@ static int read_header(ShortenContext *s)
         s->channels = 0;
         return AVERROR_INVALIDDATA;
     }
-    s->avctx->channels = s->channels;
+    if (s->avctx->ch_layout.nb_channels != s->channels) {
+        av_channel_layout_uninit(&s->avctx->ch_layout);
+        s->avctx->ch_layout.nb_channels = s->channels;
+        s->avctx->ch_layout.order       = AV_CHANNEL_ORDER_UNSPEC;
+    }
 
     /* get blocksize if version > 0 */
     if (s->version > 0) {
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to