]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Some changes to the AV sync code
authorMarten Richter <marten.richter@freenet.de>
Sun, 7 Oct 2012 11:36:45 +0000 (13:36 +0200)
committerMarten Richter <marten.richter@freenet.de>
Sun, 7 Oct 2012 11:36:45 +0000 (13:36 +0200)
videoomx.cc

index 50da6791a503f9f2d24db17b235d26e0aef34f3b..39527ac3c7b69e8c98a76b18c987a5c8abbe501e 100644 (file)
@@ -2195,7 +2195,7 @@ void VideoOMX::FrameWaitforDisplay(long long pts)
        long long offset=Demuxer::getInstance()->getFrameRate();
        long long current_time=GetCurrentSystemTime();
        if (offset==0) offset=25;
-       offset=-2*10000000LL/offset;
+       offset=-3*10000000LL/offset;
        target_time+=offset;
        //Log::getInstance()->log("Video", Log::DEBUG, "Wait for display pts: %lld tg: %lld sys: %lld off: %lld diff %lld po: %lld",pts,target_time,current_time,offset,
        //                      target_time-current_time,playbacktimeoffset);
@@ -2210,13 +2210,13 @@ void VideoOMX::FrameWaitforDisplay(long long pts)
 void VideoOMX::AdjustAudioPTS(long long pts)
 {
        long long newplaybacktimeoffset=pts-GetCurrentSystemTime();
-/*     if ((newplaybacktimeoffset-1000000LL)>playbacktimeoffset
+       if ((newplaybacktimeoffset-1000000LL)>playbacktimeoffset
            || (newplaybacktimeoffset+1000000LL)<playbacktimeoffset) {
                Log::getInstance()->log("Video", Log::DEBUG, "Adjust Playbackoffsettime o: %lld n: %lld",
-                               playbacktimeoffset,newplaybacktimeoffset);*/
+                               playbacktimeoffset,newplaybacktimeoffset);
                playbacktimeoffset=newplaybacktimeoffset;
 
-       //}
+       }
 }
 
 void VideoOMX::threadPostStopCleanup()
@@ -2265,18 +2265,19 @@ void VideoOMX::threadMethod()
                        } else {
                        //      Log::getInstance()->log("Video", Log::DEBUG,
                                //                                                                      "prot empty this buffer in");
+                               if (islast) FrameWaitforDisplay(time);
                                OMX_ERRORTYPE error = ProtOMXEmptyThisBuffer(omx_vid_dec, pict);
                                if (error != OMX_ErrorNone) {
                                        Log::getInstance()->log("Video", Log::DEBUG,
                                                        "OMX_EmptyThisBuffer failed %x", error);
                                }
                                //Log::getInstance()->log("Video", Log::DEBUG,
-                                       //                                                                                                      "prot empty this buffer out");
+                                       //                                                                                                      "time %lld",time);
                                if (deint_first_frame && dodeint) DeinterlaceFix();
-                               if (islast) FrameWaitforDisplay(time);
+
                        }
                } else {
-                       MILLISLEEP(5);
+                       MILLISLEEP(1);
                }
 
                threadCheckExit();