diff mbox series

[FFmpeg-devel] avfilter/src_movie: last_pts should be added with duration.

Message ID 20241014025330.52155-1-jiangjie618@gmail.com
State New
Headers show
Series [FFmpeg-devel] avfilter/src_movie: last_pts should be added with duration. | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

jiangjie Oct. 14, 2024, 2:53 a.m. UTC
if video has only one frame, frame->pts - st->last_pts will always be 0.
---
 libavfilter/src_movie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index d2aa572d12..8bbe913574 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -544,7 +544,7 @@  static int decode_packet(AVFilterContext *ctx, int i)
                 frame->pts += av_rescale_q_rnd(movie->ts_offset, AV_TIME_BASE_Q, outlink->time_base, AV_ROUND_UP);
             if (st->discontinuity_threshold) {
                 if (st->last_pts != AV_NOPTS_VALUE) {
-                    int64_t diff = frame->pts - st->last_pts;
+                    int64_t diff = frame->pts - (st->last_pts + pkt->duration);
                     if (diff < 0 || diff > st->discontinuity_threshold) {
                         av_log(ctx, AV_LOG_VERBOSE, "Discontinuity in stream:%d diff:%"PRId64"\n", i, diff);
                         movie->ts_offset += av_rescale_q_rnd(-diff, outlink->time_base, AV_TIME_BASE_Q, AV_ROUND_UP);