Audio Flinger and Mixer operations

by mahamannu » Thu, 05 Mar 2009 22:45:31 GMT

Sponsored Links

I'd like to know if the Audio Flinger uses the same mixer buffer for
combining Audio streams from Media Service playback [ Potentially
large buffer] , System sound [ ringtone , DTMF etc ] , Gaming Audio
[ Low latency ; small buffer ; ] at a given time. Usually Gaming Audio
might also use Media Service playback ; so essentially there may be 2
or more PV playback inputs to Audio Flinger. The concern is that
although the MIO Audio component supports Flush [ in case of a seek/FF/
Rewind on a stream] ; the next flush will be done at the DSP/H/W
level; which will not be able to distinguish between type of data if
it is mixed. It would be nice to not mix a Large Media Service output
buffer for optimization purposes with System sound ; as a flush at the
h/w will cause no system sound to be played or if the mixing is done
in serial fashion ; the time senstive System sound will play after a
large playback buffer has finished playing.


Audio Flinger and Mixer operations

by Dave Sparks » Fri, 06 Mar 2009 04:55:47 GMT

 AudioFlinger mixes into a small buffer which determines the latency
(along with the underlying hardware latency). The source buffers can
be any size. The mix buffer size has to be larger than the scheduler
interval (typically 20ms) or audio will stutter under load. That means
best case latency is around 40ms for a ping-pong buffer audio driver.


Sponsored Links

Audio Flinger and Mixer operations

by mahamannu » Wed, 11 Mar 2009 22:50:04 GMT

 Thanks Dave

I want to avoid mixing Music Stream [ from Pvplayer ] with other
Streams and re-direct the music stream to a different Audio H/W
Interface. Is it possible to send MIO buffers directly to H/W ?
Firstly what are the penalties for bypassing audio Flinger. As I
understand it is provifing Stream/Track based routing and Volume
control. MediaPlayerInterface.h recommends to implement
MediaplayerHWInterface to write directly to the HW. Are there changes
required in MediaPlayerService.cpp for this. I noticed that currently
it tries to get a Player Handle and since currently PvPlayer is of
type MediaPlayerInterface, it's audiosink object ends up forming
"tracks" to write to AudioFlinger.
Also, since AudioFlinger has the interface to AudioHardwareInterface ;
does another call to OpenOutputStream need to be made elsewhere if MIO
is to write buffers directly to H/W ?

The other design that I can think of is to have a second AudioFlinger
object instantiated by AudioSystem which will only get Music Tracks
and write to its dedicated H/W. What issues do you see with this
design ? Does the AudioFlinger need to be made multi-threaded and
thread-safe fo this ?

thanks, M


Audio Flinger and Mixer operations

by mahamannu » Wed, 11 Mar 2009 22:52:20 GMT

 Just to add to that, Is the AndroidAudioStream MIO implementation
meant for writing directly to H/W ?


Audio Flinger and Mixer operations

by Dave Sparks » Thu, 12 Mar 2009 02:52:12 GMT

  started an implementation of the Audio MIO for streaming direct to a
tunneled codec. The obstacle I ran into was that OpenCORE 1.0 does not
support falling back to software if the hardware codec is busy.

The other difficult part is that stream type volume controls (i.e.
media volume) are not available to the AudioSink. This means that the
media volume needs to be propagated through AudioFlinger to the
compressed audio driver (presumably through the kernel or a user space

We will have a solution for this problem in a post-Cupcake release
TBD. In fact, we are revisiting the entire audio architecture right
now to fix some deficiencies that have become obvious as we try to
accommodate additional use cases.

On Mar 11, 3:49 pm, mahamannu <> wrote:

Audio Flinger and Mixer operations

by ATC » Tue, 14 Apr 2009 21:42:52 GMT

 here can I modify the buffersize for the audio? I am trying to test
the effect of bigger buffer sizes for my system

- Akash

On Mar 11, 9:52 pm, Dave Sparks <> wrote:

Other Threads

1. Mod: ID-Android akan tampil di ICS 2010 @JCC Senayan, Jakarta

Keren banget nih.
Two thumbs up deh.

----- Original Message ----- From: "Agus Hamonangan" <> To: <>; <> Sent: Sunday, April 25, 2010 3:33 PM Subject: [id-android] Mod: ID-Android akan tampil di ICS 2010 @JCC Senayan, Jakarta
Rekan-rekan miliser ID Android yang berbahagia, Untuk pertama kali komunitas tercinta ID Android akan tampil di event akbar Indonesia Celluler Show, rencananya akan ada semacam workshop kecil-kecilan oleh team id-android (Lucky Sebastian,Jakontil,SA,LA dll), semoga terlaksana. Spesial thanks to Bro Rahman Hakim atas kerja kerasnya dan Doorprize dari Sonnyericsson :-) -- Salam, Agus Hamonangan

2. Still life after 12 hours unplugged

Alhamdulillah performance battery masih ok setelah 12 jam di cabut dari

Firmware masih pake jce.

Salam Brian

"Indonesian Android Community [id-android]" 

3. Kloteran Battery Gum Plus & Gum Pro - Available No

4. calling a layout

5. add marker to map with onTouchEvent

6. problem with edittext

7. Programmatically forward-lock an APK?