Hi all.

Probably someone has some guidance on this:

What I've found is that the audio flinger is preventing a single
buffer to pass through to the driver when the decoded info is too
shortThis causes that very short clips that only produce one output
buffer are not being played from the music player. The audioTrack
buffer size is calculated in this way in MediaPlayerService.cpp

    frameCount = (sampleRate*afFrameCount*bufferCount)/afSampleRate;

the af* values are constants obtained from the audio driver, and
sampleRate is the obtained from the clip (input parameter), so in the
case of high sampling rates, frameCount is high. My other concern is
the buffercount variable, which has a constant value of 4 (and the
comments mention it is a workaround) so even though that the driver
can handle the few frames of decoded data, the frameCount value
prevents the buffer to pass through to the driver, at audio flinger
level in function isReady() when framesReady (currently decoded data
on the buffer) is less than frameCount (audioTrack's bufferSize). I'm
sure there should be a reason for this.

So the only way I've thought about overcoming this is to decrease alsa
output buffer size, so frameCount variable comes out shorter and small
clips can play. This approach might hit on performance and/or cause
other issues I think.

Does any one know how to properly overcome this ? is the Music player
even designed to play very short clips  i.e. less than 1 second ? What
does the buffercount variable means ?

Thanks in advance.

- Best regards.

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to