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

Hugo Beauzee-Luyssen beauze.h at gmail.com
Tue Jun 7 15:45:22 CEST 2011

On Tue, Jun 7, 2011 at 8:02 AM, Dominique Martinet
<asmadeus at codewreck.org> wrote:
> Hi,
> Rémi Denis-Courmont wrote on Thu, Jun 02, 2011 :
>> Le jeudi 2 juin 2011 01:30:55 Jean-Baptiste Kempf, vous avez écrit :
>> > On Wed, Jun 01, 2011 at 04:21:25PM +0200, Rémi Denis-Courmont wrote :
>> > > >     // set the player's state to playing
>> > > >     result = (*p_sys->playerPlay)->SetPlayState( p_sys->playerPlay,
>> > > >
>> > > >                                                 SL_PLAYSTATE_PLAYING );
>> > > >
>> > > >     CHECK_OPENSL_ERROR( result, "Failed to switch to play state" );
>> I don't see the point in uncorking while there are no audio samples to be
>> played yet.
> I do understand this, but I'm not familiar enough with the architecture
> to figure where to put it.
> It could probably be called the first time play() is called, even though
> I'd find it kind of ugly to check that it's called for the first time,
> but if you want to be this precise I suppose you'd also want to put the
> state back to pause/stop when we pause the player.. so maybe using the
> event system?
> (so defining a function InputEvent and using something like:
> var_AddCallback( p_input, "intf-event", InputEvent, &cond );
> in the open()? I'm not even sure if I can call playlist_CurrentInput or
> something similar to get a p_input at this stage... (the line comes
> from src/playlist/fetcher.c, I just random-greped on event and picked
> something that looked appropriate without any deep reading))
> I'm open to suggestions.


This what OpenSLES doc states :
"When the player is in the SL_PLAYSTATE_PLAYING state, which is
controlled by the
SLPlayItf interface [see section 8.32], adding buffers will implicitly
start playback. In
the case of starvation due to insufficient buffers in the queue, the
playing of audio data
stops. The player remains in the SL_PLAYSTATE_PLAYING state. Upon queuing of
additional buffers, the playing of audio data resumes. Note that
starvation of queued
buffers causes audible gaps in the audio data stream. In the case
where the player is
not in the playing state, addition of buffers does not start audio playback."

Since the playback depends on both player state being
SL_PLAYSTATE_PLAYING, and the buffer queue not to be empty, it seems
useless to have some kind of flag to start the playback only after the
first call to Play(), as it is handled internally by OpenSLES.


> --
> Asmadeus | Dominique Martinet
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel

Hugo Beauzée-Luyssen

More information about the vlc-devel mailing list