[FFmpeg-cvslog] avformat/dhav: use frame number if timestamp difference is zero

Paul B Mahol git at videolan.org
Wed Sep 8 23:55:33 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Sep  8 22:46:01 2021 +0200| [7b523a06d0f4c006225c75339ce8f66b25a36f41] | committer: Paul B Mahol

avformat/dhav: use frame number if timestamp difference is zero

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

 libavformat/dhav.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/dhav.c b/libavformat/dhav.c
index 92bbfab7c5..28c476d9c1 100644
--- a/libavformat/dhav.c
+++ b/libavformat/dhav.c
@@ -47,6 +47,7 @@ typedef struct DHAVContext {
 } DHAVContext;
 
 typedef struct DHAVStream {
+    int64_t last_frame_number;
     int64_t last_timestamp;
     int64_t last_time;
     int64_t pts;
@@ -314,6 +315,8 @@ static int64_t get_pts(AVFormatContext *s, int stream_index)
 
         if (diff < 0)
             diff += 65535;
+        if (diff == 0)
+            diff = av_rescale(dhav->frame_number - dst->last_frame_number, 1000, dhav->frame_rate);
         dst->pts += diff;
     } else {
         dst->pts = t * 1000LL;
@@ -321,6 +324,7 @@ static int64_t get_pts(AVFormatContext *s, int stream_index)
 
     dst->last_time = t;
     dst->last_timestamp = dhav->timestamp;
+    dst->last_frame_number = dhav->frame_number;
 
     return dst->pts;
 }



More information about the ffmpeg-cvslog mailing list