aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-09-08 22:46:01 +0200
committerPaul B Mahol <onemda@gmail.com>2021-09-08 22:54:55 +0200
commit7b523a06d0f4c006225c75339ce8f66b25a36f41 (patch)
tree918ee175c71720afc8d8f7adfbf3102555b68d7c
parent19a17388d8c53acaeff0df59202254aa4038f6cb (diff)
downloadffmpeg-7b523a06d0f4c006225c75339ce8f66b25a36f41.tar.gz
avformat/dhav: use frame number if timestamp difference is zero
-rw-r--r--libavformat/dhav.c4
1 files changed, 4 insertions, 0 deletions
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;
}