[vlc-devel] [RFC] Android OpenSL ES audio output

Ludovic Fauvet etix at l0cal.com
Fri Jun 10 16:03:13 CEST 2011


Hello,

[...]

> /*****************************************************************************
>  * Play: play a sound
>  *****************************************************************************/
> static void Play( aout_instance_t * p_aout )
> {
>    aout_sys_t * p_sys = p_aout->output.p_sys;
>    aout_buffer_t *p_buffer;
>
>    SLresult result;
>
>    p_buffer = aout_FifoPop(p_aout, &p_aout->output.fifo);
>    if( p_buffer != NULL )
>    {
>        for (;;)
>        {
>            result = (*p_sys->playerBufferQueue)->Enqueue(
>                            p_sys->playerBufferQueue, p_buffer->p_buffer,
>                            p_buffer->i_buffer );
>            if( result == SL_RESULT_SUCCESS )
>                break;

If the Enqueue function never returns SL_RESULT_SUCCESS for whatever
reason you're stuck inside an infinite loop.

>
>            msg_Err( p_aout, "write error (%lu)", result );
>
>            // Wait a bit to retry. might miss calls to *cancel
>            // but this is supposed to be rare anyway
>            msleep(CLOCK_FREQ);
>        }
>        p_sys->p_buffer_array[p_sys->i_toappend_buffer] = p_buffer;
>        if( ++p_sys->i_toappend_buffer == BUFF_QUEUE )
>            p_sys->i_toappend_buffer = 0;
>    }
>    else
>        msg_Err( p_aout, "nothing to play?" );
> }

[...]

-- 
Ludovic Fauvet (etix)



More information about the vlc-devel mailing list