CLOCK_REALTIME -> CLOCK_MONOTONIC to allow time changes.

This commit is contained in:
Johns 2013-10-08 10:18:04 +02:00
parent e3b32861b0
commit fb2a7f9959
2 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,7 @@
User johns User johns
Date: Date:
CLOCK_REALTIME -> CLOCK_MONOTONIC to allow time changes.
Add function VideoStreamOpen and always use VideoStreamClose. Add function VideoStreamOpen and always use VideoStreamClose.
Softer audio/video sync. Softer audio/video sync.
Add function GetStats to the video output module. Add function GetStats to the video output module.

12
video.c
View File

@ -3491,7 +3491,7 @@ static void VaapiBlackSurface(VaapiDecoder * decoder)
VA_FRAME_PICTURE)) != VA_STATUS_SUCCESS) { VA_FRAME_PICTURE)) != VA_STATUS_SUCCESS) {
Error(_("video/vaapi: vaPutSurface failed %d\n"), status); Error(_("video/vaapi: vaPutSurface failed %d\n"), status);
} }
clock_gettime(CLOCK_REALTIME, &decoder->FrameTime); clock_gettime(CLOCK_MONOTONIC, &decoder->FrameTime);
put1 = GetMsTicks(); put1 = GetMsTicks();
if (put1 - sync > 2000) { if (put1 - sync > 2000) {
@ -4731,7 +4731,7 @@ static void VaapiDisplayFrame(void)
put2 = put1; put2 = put1;
#endif #endif
} }
clock_gettime(CLOCK_REALTIME, &nowtime); clock_gettime(CLOCK_MONOTONIC, &nowtime);
// FIXME: 31 only correct for 50Hz // FIXME: 31 only correct for 50Hz
if ((nowtime.tv_sec - decoder->FrameTime.tv_sec) if ((nowtime.tv_sec - decoder->FrameTime.tv_sec)
* 1000 * 1000 * 1000 + (nowtime.tv_nsec - * 1000 * 1000 * 1000 + (nowtime.tv_nsec -
@ -5159,7 +5159,7 @@ static void VaapiDisplayHandlerThread(void)
} }
} }
clock_gettime(CLOCK_REALTIME, &nowtime); clock_gettime(CLOCK_MONOTONIC, &nowtime);
// time for one frame over? // time for one frame over?
if ((nowtime.tv_sec - decoder->FrameTime.tv_sec) if ((nowtime.tv_sec - decoder->FrameTime.tv_sec)
* 1000 * 1000 * 1000 + (nowtime.tv_nsec - decoder->FrameTime.tv_nsec) < * 1000 * 1000 * 1000 + (nowtime.tv_nsec - decoder->FrameTime.tv_nsec) <
@ -8382,7 +8382,7 @@ static void VdpauDisplayFrame(void)
VdpauGetErrorString(status)); VdpauGetErrorString(status));
} }
// FIXME: CLOCK_MONOTONIC_RAW // FIXME: CLOCK_MONOTONIC_RAW
clock_gettime(CLOCK_REALTIME, &VdpauFrameTime); clock_gettime(CLOCK_MONOTONIC, &VdpauFrameTime);
for (i = 0; i < VdpauDecoderN; ++i) { for (i = 0; i < VdpauDecoderN; ++i) {
// remember time of last shown surface // remember time of last shown surface
VdpauDecoders[i]->FrameTime = VdpauFrameTime; VdpauDecoders[i]->FrameTime = VdpauFrameTime;
@ -8884,7 +8884,7 @@ static void VdpauDisplayHandlerThread(void)
usleep(5 * 1000); usleep(5 * 1000);
} }
clock_gettime(CLOCK_REALTIME, &nowtime); clock_gettime(CLOCK_MONOTONIC, &nowtime);
// time for one frame over? // time for one frame over?
if ((nowtime.tv_sec - VdpauFrameTime.tv_sec) * 1000 * 1000 * 1000 + if ((nowtime.tv_sec - VdpauFrameTime.tv_sec) * 1000 * 1000 * 1000 +
(nowtime.tv_nsec - VdpauFrameTime.tv_nsec) < 15 * 1000 * 1000) { (nowtime.tv_nsec - VdpauFrameTime.tv_nsec) < 15 * 1000 * 1000) {
@ -8893,7 +8893,7 @@ static void VdpauDisplayHandlerThread(void)
if (VdpauPreemption) { // display preempted if (VdpauPreemption) { // display preempted
if (VdpauPreemptionRecover()) { if (VdpauPreemptionRecover()) {
clock_gettime(CLOCK_REALTIME, &VdpauFrameTime); clock_gettime(CLOCK_MONOTONIC, &VdpauFrameTime);
return; return;
} }
} }