fftools/ffmpeg_enc: do not round frame durations prematurely

Changes the results of fate-idroq-video-encode and fate-lavf* tests,
where different frames now get duplicated by framerate conversion code.
This commit is contained in:
Anton Khirnov 2023-10-01 14:33:13 +02:00
parent 303f10d4dd
commit 9d4ca76c08
9 changed files with 23 additions and 23 deletions

View file

@ -1030,11 +1030,11 @@ static void video_sync_process(OutputFile *of, OutputStream *ost,
*nb_frames = 0;
else if (delta > 0.6)
e->next_pts = llrint(sync_ipts);
frame->duration = duration;
frame->duration = llrint(duration);
break;
case VSYNC_DROP:
case VSYNC_PASSTHROUGH:
frame->duration = duration;
frame->duration = llrint(duration);
e->next_pts = llrint(sync_ipts);
break;
default:
@ -1112,7 +1112,7 @@ static int do_video_out(OutputFile *of, OutputStream *ost, AVFrame *frame)
if (frame) {
FrameData *fd = frame_data(frame);
duration = lrintf(frame->duration * av_q2d(frame->time_base) / av_q2d(enc->time_base));
duration = frame->duration * av_q2d(frame->time_base) / av_q2d(enc->time_base);
if (duration <= 0 &&
fd->frame_rate_filter.num > 0 && fd->frame_rate_filter.den > 0)