• Martin Storsjö's avatar
    Fix the msleep nanosleep wrapping · 661f6386
    Martin Storsjö authored
    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: default avatarMartin Storsjö <martin@martin.st>