From be1c30befb26a001edf1e3b704ac19e63ce711b0 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sun, 9 Sep 2012 12:12:01 +0200 Subject: [PATCH] Enhanced lipsync --- videoomx.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/videoomx.cc b/videoomx.cc index 57e2e6c..e1014e5 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -1665,11 +1665,11 @@ bool VideoOMX::FrameSkip(long long pts) // we have to wait untile the next frame long long offset=Demuxer::getInstance()->getFrameRate(); if (offset==0) offset=25; - offset=10000000LL/offset; + offset=-2*10000000LL/offset; target_time+=offset; long long current_time=GetCurrentSystemTime(); if (!skipping) { - if ((target_time-current_time)<-1000000LL) { + if ((target_time-current_time)<-400000LL) { skip=true; // we are too slow skipping=true; /* Log::getInstance()->log("Video", Log::DEBUG, @@ -1680,7 +1680,7 @@ bool VideoOMX::FrameSkip(long long pts) skipping=false; } } else { - if ((target_time - current_time) < 0LL) { + if ((target_time - current_time) < 0000LL) { //skip a bit more skip = true; // we are too slow skipping = true; /* Log::getInstance()->log("Video", Log::DEBUG,"Skipping frames2 %lld %lld",target_time-current_time,pts); @@ -1703,7 +1703,7 @@ void VideoOMX::FrameWaitforDisplay(long long pts) long long offset=Demuxer::getInstance()->getFrameRate(); long long current_time=GetCurrentSystemTime(); if (offset==0) offset=25; - offset=10000000LL/offset; + offset=-2*10000000LL/offset; target_time+=offset; if ((target_time-current_time)>1000000LL) target_time=current_time+1000000LL; // something is wrong do not wait too long //Log::getInstance()->log("Video", Log::DEBUG, "Wait for display pts: %lld target: %lld sys: %lld off: %lld diff %lld",pts,target_time,current_time,offset, -- 2.39.2