mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-12 02:19:35 +00:00
fftools/ffmpeg_enc: move remaining vsync-related code to video_sync_process()
This commit is contained in:
parent
a9b9e771b3
commit
096d88dcc6
@ -1036,6 +1036,30 @@ finish:
|
|||||||
e->frames_prev_hist,
|
e->frames_prev_hist,
|
||||||
sizeof(e->frames_prev_hist[0]) * (FF_ARRAY_ELEMS(e->frames_prev_hist) - 1));
|
sizeof(e->frames_prev_hist[0]) * (FF_ARRAY_ELEMS(e->frames_prev_hist) - 1));
|
||||||
e->frames_prev_hist[0] = *nb_frames_prev;
|
e->frames_prev_hist[0] = *nb_frames_prev;
|
||||||
|
|
||||||
|
if (*nb_frames_prev == 0 && ost->last_dropped) {
|
||||||
|
ost->nb_frames_drop++;
|
||||||
|
av_log(ost, AV_LOG_VERBOSE,
|
||||||
|
"*** dropping frame %"PRId64" at ts %"PRId64"\n",
|
||||||
|
e->vsync_frame_number, e->last_frame->pts);
|
||||||
|
}
|
||||||
|
if (*nb_frames > (*nb_frames_prev && ost->last_dropped) + (*nb_frames > *nb_frames_prev)) {
|
||||||
|
if (*nb_frames > dts_error_threshold * 30) {
|
||||||
|
av_log(ost, AV_LOG_ERROR, "%"PRId64" frame duplication too large, skipping\n", *nb_frames - 1);
|
||||||
|
ost->nb_frames_drop++;
|
||||||
|
*nb_frames = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ost->nb_frames_dup += *nb_frames - (*nb_frames_prev && ost->last_dropped) - (*nb_frames > *nb_frames_prev);
|
||||||
|
av_log(ost, AV_LOG_VERBOSE, "*** %"PRId64" dup!\n", *nb_frames - 1);
|
||||||
|
if (ost->nb_frames_dup > e->dup_warning) {
|
||||||
|
av_log(ost, AV_LOG_WARNING, "More than %"PRIu64" frames duplicated\n", e->dup_warning);
|
||||||
|
e->dup_warning *= 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ost->last_dropped = *nb_frames == *nb_frames_prev && frame;
|
||||||
|
ost->kf.dropped_keyframe = ost->last_dropped && frame && (frame->flags & AV_FRAME_FLAG_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
|
static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
|
||||||
@ -1101,28 +1125,6 @@ static int do_video_out(OutputFile *of, OutputStream *ost, AVFrame *frame)
|
|||||||
video_sync_process(of, ost, frame,
|
video_sync_process(of, ost, frame,
|
||||||
&nb_frames, &nb_frames_prev);
|
&nb_frames, &nb_frames_prev);
|
||||||
|
|
||||||
if (nb_frames_prev == 0 && ost->last_dropped) {
|
|
||||||
ost->nb_frames_drop++;
|
|
||||||
av_log(ost, AV_LOG_VERBOSE,
|
|
||||||
"*** dropping frame %"PRId64" at ts %"PRId64"\n",
|
|
||||||
e->vsync_frame_number, e->last_frame->pts);
|
|
||||||
}
|
|
||||||
if (nb_frames > (nb_frames_prev && ost->last_dropped) + (nb_frames > nb_frames_prev)) {
|
|
||||||
if (nb_frames > dts_error_threshold * 30) {
|
|
||||||
av_log(ost, AV_LOG_ERROR, "%"PRId64" frame duplication too large, skipping\n", nb_frames - 1);
|
|
||||||
ost->nb_frames_drop++;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ost->nb_frames_dup += nb_frames - (nb_frames_prev && ost->last_dropped) - (nb_frames > nb_frames_prev);
|
|
||||||
av_log(ost, AV_LOG_VERBOSE, "*** %"PRId64" dup!\n", nb_frames - 1);
|
|
||||||
if (ost->nb_frames_dup > e->dup_warning) {
|
|
||||||
av_log(ost, AV_LOG_WARNING, "More than %"PRIu64" frames duplicated\n", e->dup_warning);
|
|
||||||
e->dup_warning *= 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ost->last_dropped = nb_frames == nb_frames_prev && frame;
|
|
||||||
ost->kf.dropped_keyframe = ost->last_dropped && frame && (frame->flags & AV_FRAME_FLAG_KEY);
|
|
||||||
|
|
||||||
/* duplicates frame if needed */
|
/* duplicates frame if needed */
|
||||||
for (i = 0; i < nb_frames; i++) {
|
for (i = 0; i < nb_frames; i++) {
|
||||||
AVFrame *in_picture;
|
AVFrame *in_picture;
|
||||||
|
Loading…
Reference in New Issue
Block a user