mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
GLFB: add a few sanity checks for sleep interval
This commit is contained in:
@@ -358,7 +358,8 @@ void GLFramebuffer::render()
|
|||||||
GLuint err = glGetError();
|
GLuint err = glGetError();
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
lt_info("GLFB::%s: GLError:%d 0x%04x\n", __func__, err, err);
|
lt_info("GLFB::%s: GLError:%d 0x%04x\n", __func__, err, err);
|
||||||
usleep(sleep_us);
|
if (sleep_us > 0)
|
||||||
|
usleep(sleep_us);
|
||||||
glutPostRedisplay();
|
glutPostRedisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,12 +516,14 @@ void GLFramebuffer::bltDisplayBuffer()
|
|||||||
sleep_us -= 1000;
|
sleep_us -= 1000;
|
||||||
last_apts = apts;
|
last_apts = apts;
|
||||||
videoDecoder->getPictureInfo(dummy1, dummy2, rate);
|
videoDecoder->getPictureInfo(dummy1, dummy2, rate);
|
||||||
if (rate)
|
if (rate > 0)
|
||||||
rate = 2000000 / rate; /* limit to half the frame rate */
|
rate = 2000000 / rate; /* limit to half the frame rate */
|
||||||
else
|
else
|
||||||
rate = 50000; /* minimum 20 fps */
|
rate = 50000; /* minimum 20 fps */
|
||||||
if (sleep_us > rate)
|
if (sleep_us > rate)
|
||||||
sleep_us = rate;
|
sleep_us = rate;
|
||||||
|
else if (sleep_us < 1)
|
||||||
|
sleep_us = 1;
|
||||||
}
|
}
|
||||||
lt_debug("vpts: 0x%" PRIx64 " apts: 0x%" PRIx64 " diff: %6.3f sleep_us %d buf %d\n",
|
lt_debug("vpts: 0x%" PRIx64 " apts: 0x%" PRIx64 " diff: %6.3f sleep_us %d buf %d\n",
|
||||||
buf->pts(), apts, (buf->pts() - apts)/90000.0, sleep_us, videoDecoder->buf_num);
|
buf->pts(), apts, (buf->pts() - apts)/90000.0, sleep_us, videoDecoder->buf_num);
|
||||||
|
Reference in New Issue
Block a user