[MPlayer-users] Regression in version 34853 of mplayer, audio times out

stan RegBur_Flydan8 at q.com
Fri Apr 13 19:06:37 CEST 2012


Hi,

I'm using version 34853, and it is generating the message
Audio device got stuck!
when playing audio from the command line.  It happens intermittently,
anywhere from a few seconds up to a minute.  It never used to do that. I
am running Fedora F17, and the version of mplayer (SVN-r34652) they have
packaged does not have this issue.

I searched the code, and it seems to be a timeout / sleep issue when
playing audio.  The code snippet in mplayer.c with the problem is below;
the message is the AudioDeviceStuck.

static int fill_audio_out_buffers(void)
{
    unsigned int t;
    double tt;
    int playsize;
    int playflags = 0;
    int audio_eof = 0;
    int bytes_to_write;
    int format_change = 0;
    int timeout = 0;
    sh_audio_t *const sh_audio = mpctx->sh_audio;

    current_module = "play_audio";

    while (1) {
        int sleep_time;
        // all the current uses of ao_data.pts seem to be in aos that handle
        // sync completely wrong; there should be no need to use ao_data.pts
        // in get_space()
        ao_data.pts    = ((mpctx->sh_video ? mpctx->sh_video->timer : 0) + mpctx->delay) * 90000.0;
        bytes_to_write = mpctx->audio_out->get_space();
        if (mpctx->sh_video || bytes_to_write >= ao_data.outburst)
            break;
        if (timeout++ > 10) {
            mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_AudioDeviceStuck);
            break;
        }

        // handle audio-only case:
        // this is where mplayer sleeps during audio-only playback
        // to avoid 100% CPU use
        sleep_time = (ao_data.outburst - bytes_to_write) * 1000 / ao_data.bps;
        if (sleep_time < 10)
            sleep_time = 10;                  // limit to 100 wakeups per second
        usec_sleep(sleep_time * 1000);
    }


More information about the MPlayer-users mailing list