[FFmpeg-cvslog] avformat/moflex: Don't use uninitialized timebase for data stream

Andreas Rheinhardt git at videolan.org
Wed Jan 12 02:50:08 EET 2022


ffmpeg | branch: release/4.4 | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Dec 12 16:02:22 2021 +0100| [703937c494bfb7fe74ea22c361e9444eaa65c61e] | committer: Andreas Rheinhardt

avformat/moflex: Don't use uninitialized timebase for data stream

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
(cherry picked from commit 38e5ca9310b1a4dbb72fbe28769c9119bb880691)

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

 libavformat/moflex.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavformat/moflex.c b/libavformat/moflex.c
index 0706f88e64..ca40b51c3e 100644
--- a/libavformat/moflex.c
+++ b/libavformat/moflex.c
@@ -172,7 +172,7 @@ static int moflex_read_sync(AVFormatContext *s)
         unsigned type, ssize, codec_id = 0;
         unsigned codec_type, width = 0, height = 0, sample_rate = 0, channels = 0;
         int stream_index = -1;
-        AVRational fps;
+        AVRational tb = av_make_q(0, 1);
 
         read_var_byte(s, &type);
         read_var_byte(s, &ssize);
@@ -195,6 +195,7 @@ static int moflex_read_sync(AVFormatContext *s)
                 return AVERROR_PATCHWELCOME;
             }
             sample_rate = avio_rb24(pb) + 1;
+            tb = av_make_q(1, sample_rate);
             channels = avio_r8(pb) + 1;
             break;
         case 1:
@@ -208,8 +209,8 @@ static int moflex_read_sync(AVFormatContext *s)
                 av_log(s, AV_LOG_ERROR, "Unsupported video codec: %d\n", codec_id);
                 return AVERROR_PATCHWELCOME;
             }
-            fps.num = avio_rb16(pb);
-            fps.den = avio_rb16(pb);
+            tb.den = avio_rb16(pb);
+            tb.num = avio_rb16(pb);
             width = avio_rb16(pb);
             height = avio_rb16(pb);
             avio_skip(pb, type == 3 ? 3 : 2);
@@ -237,10 +238,8 @@ static int moflex_read_sync(AVFormatContext *s)
             if (!st->priv_data)
                 return AVERROR(ENOMEM);
 
-            if (sample_rate)
-                avpriv_set_pts_info(st, 63, 1, sample_rate);
-            else
-                avpriv_set_pts_info(st, 63, fps.den, fps.num);
+            if (tb.num)
+                avpriv_set_pts_info(st, 63, tb.num, tb.den);
         }
     }
 



More information about the ffmpeg-cvslog mailing list