Commit 661f6386 authored by Martin Storsjö's avatar Martin Storsjö

Fix the msleep nanosleep wrapping

The condition was inverted - the loop is supposed to sleep in 10 ms
increments. A one second msleep in practice slept for about 50 seconds.

Previously, if t.tv_nsec (the amount we actually sleep) was less than
ts.tv_nsec (the amount we should sleep in total), we actually slept the
full duration, but only subtracted 10 ms from the total time to sleep.

This fixes cases where the application hung with "can't get output
picture" at the end, if using hw decoding, and fixes audio output
with hw decoders on Samsung Galaxy S II when using the OpenSLES
aout, where the msleep(CLOCK_FREQ) hung for a very long time.
Signed-off-by: Martin Storsjö's avatarMartin Storsjö <martin@martin.st>
parent e1e93688
......@@ -522,7 +522,7 @@ index a7a4873..598c692 100644
+ vlc_testcancel();
+ for (;;) {
+ struct timespec t = { 0, 10 * 1000 * 1000 };
+ if (t.tv_nsec < ts.tv_nsec)
+ if (ts.tv_sec <= 0 && t.tv_nsec > ts.tv_nsec)
+ t.tv_nsec = ts.tv_nsec;
+ while (nanosleep (&t, &t) == -1) {
+ vlc_testcancel();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment