[FFmpeg-cvslog] avformat/mvdec: fix reading number of audio channels

John-Paul Stewart git at videolan.org
Fri Dec 3 10:57:38 EET 2021


ffmpeg | branch: master | John-Paul Stewart <jpstewart at personalprojects.net> | Sat Nov 27 16:45:50 2021 -0500| [4a90c039e7a17c913d2961f902f667d38490b6ab] | committer: Peter Ross

avformat/mvdec: fix reading number of audio channels

The number of audio channels is stored after the magic number
identifying the audio format.  Prior to this patch the code has been
reading it earlier, causing files with only one audio channel to be
handled incorrectly.

Reviewed-by: Peter Ross <pross at xvid.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a90c039e7a17c913d2961f902f667d38490b6ab
---

 libavformat/mvdec.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index d58281c3a9..8492928820 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -340,8 +340,8 @@ static int mv_read_header(AVFormatContext *avctx)
             return AVERROR_INVALIDDATA;
         }
         avpriv_set_pts_info(ast, 33, 1, ast->codecpar->sample_rate);
-        if (set_channels(avctx, ast, avio_rb32(pb)) < 0)
-            return AVERROR_INVALIDDATA;
+
+        avio_skip(pb, 4);
 
         v = avio_rb32(pb);
         if (v == AUDIO_FORMAT_SIGNED) {
@@ -350,7 +350,11 @@ static int mv_read_header(AVFormatContext *avctx)
             avpriv_request_sample(avctx, "Audio compression (format %i)", v);
         }
 
-        avio_skip(pb, 12);
+        if (set_channels(avctx, ast, avio_rb32(pb)) < 0)
+            return AVERROR_INVALIDDATA;
+
+        avio_skip(pb, 8);
+
         var_read_metadata(avctx, "title", 0x80);
         var_read_metadata(avctx, "comment", 0x100);
         avio_skip(pb, 0x80);



More information about the ffmpeg-cvslog mailing list