From 5875e10479379be1a82f5e07002802a1cb721ced Mon Sep 17 00:00:00 2001 From: jojo61 Date: Wed, 1 Apr 2020 12:45:33 +0200 Subject: [PATCH] Honor Softstartflag --- video.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/video.c b/video.c index 3b3f6b8..49029f2 100644 --- a/video.c +++ b/video.c @@ -4347,13 +4347,14 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder) decoder->TrickCounter = decoder->TrickSpeed; goto skip_sync; } +#if 0 // at start of new video stream, soft or hard sync video to audio if (!VideoSoftStartSync && decoder->StartCounter < VideoSoftStartFrames && video_clock != (int64_t) AV_NOPTS_VALUE && (audio_clock == (int64_t) AV_NOPTS_VALUE || video_clock > audio_clock + VideoAudioDelay + 120 * 90)) { Debug(4, "video: initial slow down video, frame %d\n", decoder->StartCounter); goto skip_sync; } - +#endif if (decoder->SyncCounter && decoder->SyncCounter--) { goto skip_sync; } @@ -4378,10 +4379,10 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder) goto skip_sync; } else if (diff > 100 * 90) { - // FIXME: this quicker sync step, did not work with new code! + err = CuvidMessage(4, "video: slow down video, duping frame %d\n", diff / 90); ++decoder->FramesDuped; - if (speedup && --speedup) + if ((speedup && --speedup) || VideoSoftStartSync) decoder->SyncCounter = 1; else decoder->SyncCounter = 0; @@ -4404,7 +4405,7 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder) decoder->SyncCounter = 1; } else { - speedup = 3; + speedup = 2; } #if defined(DEBUG) || defined(AV_INFO) if (!decoder->SyncCounter && decoder->StartCounter < 1000) {