[FFmpeg-devel] [PATCH 1/3] libavformat/demux.c: compute_frame_duration() add null check

Scott Theisen scott.the.elm at gmail.com
Thu Nov 14 07:52:06 EET 2024


from https://github.com/MythTV/mythtv/commit/28d2b3e87763c6102d20cfe959547b1a5f5cd609
---
 libavformat/demux.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index cba1f2e4df..b4fa7f912d 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -693,6 +693,10 @@ static void compute_frame_duration(AVFormatContext *s, int *pnum, int *pden,
 
     *pnum = 0;
     *pden = 0;
+
+    if (!st || !st->codecpar)
+        return;
+
     switch (st->codecpar->codec_type) {
     case AVMEDIA_TYPE_VIDEO:
         if (st->r_frame_rate.num && (!pc || !codec_framerate.num)) {
-- 
2.43.0



More information about the ffmpeg-devel mailing list