1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

Improved Placebo Frame turnaroundtime

This commit is contained in:
jojo61 2019-11-02 13:28:42 +01:00
parent 146b826b4d
commit a4bee138f2

16
video.c
View File

@ -3718,37 +3718,32 @@ static void CuvidDisplayFrame(void)
if (ldiff < 100.0 && ldiff > 0.0) if (ldiff < 100.0 && ldiff > 0.0)
CuvidDecoders[0]->Frameproc = (CuvidDecoders[0]->Frameproc + ldiff + ldiff) / 3.0; CuvidDecoders[0]->Frameproc = (CuvidDecoders[0]->Frameproc + ldiff + ldiff) / 3.0;
} }
round_time = GetusTicks(); round_time = GetusTicks();
#if 1 #if 1
diff = (GetusTicks() - last_time) / 1000; diff = (GetusTicks() - last_time) / 1000;
// last_time = GetusTicks(); // last_time = GetusTicks();
// printf("Roundtrip Displayframe %d\n",diff); // printf("Roundtrip Displayframe %d\n",diff);
if (diff < 15000 && diff > 0) { if (diff < 5000 && diff > 0) {
// printf("Sleep %d\n",15000-diff); // printf("Sleep %d\n",15000-diff);
usleep((15000 - diff)); // * 1000); usleep((5000 - diff)); // * 1000);
} }
#endif #endif
if (!p->swapchain) if (!p->swapchain)
return; return;
// last_time = GetusTicks();
#ifdef CUVID #ifdef CUVID
// first_time = GetusTicks();
VideoThreadLock(); VideoThreadLock();
if (!first) { if (!first) {
// last_time = GetusTicks();
if (!pl_swapchain_submit_frame(p->swapchain)) if (!pl_swapchain_submit_frame(p->swapchain))
Error(_("Failed to submit swapchain buffer\n")); Error(_("Failed to submit swapchain buffer\n"));
pl_swapchain_swap_buffers(p->swapchain); // swap buffers pl_swapchain_swap_buffers(p->swapchain); // swap buffers
// printf("submit and swap %d\n",(GetusTicks()-last_time)/1000000);
} }
#endif #endif
first = 0; first = 0;
last_time = GetusTicks(); last_time = GetusTicks();
while (!pl_swapchain_start_frame(p->swapchain, &frame)) { // get new frame wait for previous to swap while (!pl_swapchain_start_frame(p->swapchain, &frame)) { // get new frame wait for previous to swap
@ -3916,10 +3911,9 @@ static void CuvidDisplayFrame(void)
if (!pl_swapchain_submit_frame(p->swapchain)) if (!pl_swapchain_submit_frame(p->swapchain))
Fatal(_("Failed to submit swapchain buffer\n")); Fatal(_("Failed to submit swapchain buffer\n"));
pl_swapchain_swap_buffers(p->swapchain); // swap buffers pl_swapchain_swap_buffers(p->swapchain); // swap buffers
// printf("submit and swap %d us\n",(GetusTicks()-first_time)/1000);
#endif #endif
VideoThreadUnlock(); VideoThreadUnlock();
// printf("Display time %d\n",(GetusTicks()-first_time)/1000000);
#else #else
#ifdef CUVID #ifdef CUVID
glXGetVideoSyncSGI(&Count); // get current frame glXGetVideoSyncSGI(&Count); // get current frame