Skip to content

Commit

Permalink
Fixed drift caused by rounding errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfryd committed Dec 23, 2023
1 parent 42bfe43 commit 11258f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion video_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool VideoDecoder::receive(AVFrame* frame, Demuxer* demuxer) {
const int64_t avframe_pts = frame->pts != AV_NOPTS_VALUE ? frame->pts : frame->best_effort_timestamp;

// use an increasing timestamp via pkt_duration between keyframes; otherwise, fall back to the best effort timestamp when PTS is not available
frame->pts = use_avframe_state ? avframe_pts : next_pts_;
frame->pts = (use_avframe_state || (next_pts_ + 1) == avframe_pts) ? avframe_pts : next_pts_;

// ensure pkt_duration is always some sensible value
if (frame->pkt_duration == 0) {
Expand Down

0 comments on commit 11258f3

Please sign in to comment.