This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 056192a835330ec476ca5254302b682c7c8d2623
Author:     Zhao Zhili <[email protected]>
AuthorDate: Sat May 23 02:25:41 2026 +0800
Commit:     Zhao Zhili <[email protected]>
CommitDate: Sun Jul 5 04:15:26 2026 +0000

    avformat/mods: fix keyframe flagging in read_packet
    
    avformat_index_get_entry_from_timestamp() was called with the file
    position passed as wanted_timestamp, so the lookup was meaningless.
    Use ffstream(st)->cur_dts as the wanted timestamp.
---
 libavformat/mods.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/mods.c b/libavformat/mods.c
index 7949bcd657..c6267fa621 100644
--- a/libavformat/mods.c
+++ b/libavformat/mods.c
@@ -92,6 +92,7 @@ static int mods_read_header(AVFormatContext *s)
     if (!e)
         return AVERROR_INVALIDDATA;
 
+    avpriv_update_cur_dts(s, st, e->timestamp);
     avio_seek(pb, e->pos, SEEK_SET);
 
     return 0;
@@ -101,6 +102,7 @@ static int mods_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 {
     AVIOContext *pb = s->pb;
     MODSDemuxContext *ctx = s->priv_data;
+    AVStream *st = s->streams[0];
     unsigned size;
     int64_t pos;
     int ret;
@@ -119,9 +121,11 @@ static int mods_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     pkt->pos = pos;
     pkt->stream_index = 0;
 
-    e = avformat_index_get_entry_from_timestamp(s->streams[0], pos, 0);
-    if (e)
+    e = avformat_index_get_entry_from_timestamp(st, ffstream(st)->cur_dts, 0);
+    if (e && e->pos == pos) {
         pkt->flags |= AV_PKT_FLAG_KEY;
+        pkt->pts = pkt->dts = e->timestamp;
+    }
 
     return ret;
 }

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to