Speedup queuing output surface, when decoder buffers are full.

This commit is contained in:
Johns 2015-09-30 11:27:10 +02:00
parent 93981031aa
commit f47ee3a201
2 changed files with 15 additions and 7 deletions

View File

@ -1,6 +1,7 @@
User johns User johns
Date: Date:
Speedup queuing output surface, when decoder buffers are full.
Fix bug: info shows wrong decoded video surfaces. Fix bug: info shows wrong decoded video surfaces.
Calculate queued output surfaces and show them in info message. Calculate queued output surfaces and show them in info message.
Add support for new API of vdr 2.3.1. Add support for new API of vdr 2.3.1.

21
video.c
View File

@ -9153,10 +9153,12 @@ static void VdpauDisplayHandlerThread(void)
{ {
int i; int i;
int err; int err;
int allfull;
int decoded; int decoded;
struct timespec nowtime; struct timespec nowtime;
VdpauDecoder *decoder; VdpauDecoder *decoder;
allfull = 1;
decoded = 0; decoded = 0;
pthread_mutex_lock(&VideoLockMutex); pthread_mutex_lock(&VideoLockMutex);
for (i = 0; i < VdpauDecoderN; ++i) { for (i = 0; i < VdpauDecoderN; ++i) {
@ -9171,6 +9173,7 @@ static void VdpauDisplayHandlerThread(void)
if (filled < VIDEO_SURFACES_MAX) { if (filled < VIDEO_SURFACES_MAX) {
// FIXME: hot polling // FIXME: hot polling
// fetch+decode or reopen // fetch+decode or reopen
allfull = 0;
err = VideoDecodeInput(decoder->Stream); err = VideoDecodeInput(decoder->Stream);
} else { } else {
err = VideoPollInput(decoder->Stream); err = VideoPollInput(decoder->Stream);
@ -9193,14 +9196,18 @@ static void VdpauDisplayHandlerThread(void)
if (!decoded) { // nothing decoded, sleep if (!decoded) { // nothing decoded, sleep
// FIXME: sleep on wakeup // FIXME: sleep on wakeup
usleep(5 * 1000); usleep(1 * 1000);
} }
// all decoder buffers are full
clock_gettime(CLOCK_MONOTONIC, &nowtime); // and display is not preempted
// time for one frame over? // speed up filling display queue, wait on display queue empty
if ((nowtime.tv_sec - VdpauFrameTime.tv_sec) * 1000 * 1000 * 1000 + if (!allfull || VdpauPreemption) {
(nowtime.tv_nsec - VdpauFrameTime.tv_nsec) < 15 * 1000 * 1000) { clock_gettime(CLOCK_MONOTONIC, &nowtime);
return; // time for one frame over?
if ((nowtime.tv_sec - VdpauFrameTime.tv_sec) * 1000 * 1000 * 1000 +
(nowtime.tv_nsec - VdpauFrameTime.tv_nsec) < 15 * 1000 * 1000) {
return;
}
} }
if (VdpauPreemption) { // display preempted if (VdpauPreemption) { // display preempted