Android Audio System Introduction. Outline Background Android Audio System Audio Framework Audio HAL 2

  • View
    264

  • Download
    2

Embed Size (px)

Text of Android Audio System Introduction. Outline Background Android Audio System Audio Framework Audio HAL...

  • Android Audio System Introduction

  • OutlineBackgroundAndroid Audio SystemAudio FrameworkAudio HAL

    *

  • Background*

  • BackgroundInformation about this slideSoftwareAndroid 4.0/4.2

    *

  • Android Audio System*

  • Architecture Audio SystemThe complexity of android audio systemSoft real-time requirementLarge number of usage scenariosSoftwarephone/media player/different volume setting/Hardwareearpiece/speaker/hdmi/mic/bluetooth/Flexibility designgood design patternperformance (Java/JNI/binder/)*

  • Architecture Audio System*

  • Android Audio System*data flowpcm dataAudio PolicyAudio Flinger

  • Audio Framework*

  • Audio Framework*routerreceiver 1sender 1Network Packet Routingsender 2sender 3sender 4receiver 2receiver 3Routing path

  • Audio Framework*Audio PolicyHardware 1AudioTrack 1Audio Routing (play audio)Hardware 2Hardware 3Audio FlingerAudioTrack 2AudioTrack 3AudioTrack 4Java AppAudio FrameworkAudio HAL

  • Audio PolicyDecide which thread in AudioFlinger should sound be attached.stream strategy outputstream : VOICE_CALL, TTS, MUSIC, strategy : PHONE, MUSIC, output : a thread in AudioFlingerstrategy : bridge between software data stream and hardware

    *

  • Audio Policy

    *

  • Audio PolicyIOProfile (audio_policy.conf)ContentDefine all the possible I/O devicesDefine default I/O deviceHierarchical structurehardware moduleprofilesampling_rates/channels/formats/devices/flagsWith IOProfile, audio policy gets better OO structure.

    *

  • Audio Policy

    *

  • Audio FlingerSeveral thread to read/write dataCreate thread by AudioPolicymixer threadduplicating threaddirect output threadResamplerNon-blocking audio I/OAudioWatchdog

    *

  • Audio HAL*

  • Audio HALPlatform Group*

    app

    AudioTrack/AudioRecord/(AudioPolicy/AudioFlinger/)

    Audio HAL(open/read/write/)

    Audio Driver

  • Audio HALALSA (Advanced Linux Sound Architecture)unified interface/SMP/thread-safe/usespace libraryalsa-libtinyalsatinyplay/tinycap/ tinymix

    Audio HAL interfacevolume settingI/O function

    *

    *** Mint code** FM7.1 ** play record Audio System *****4.0 -> 4.2 7xxx ~ 9xxx (Leo 3926) 14xxx ~ 20xxx

    TODO : 5 ~ 9FIXME : 4 ~ 28**1. The original version is provided fromSoC vendor.2. Dynamic library linked byAudioFlinger.

    *Why use TinyalsaWe can use ALSA-lib substitute for Tinyalsacompletely, but we cant use Tinyalsa substitute for ALSA-lib completely. But,in some times, Tinyalsa can substitute for ALSA-lib to work for some basicfunction.The only reason is that it is smaller and simpler than ALSA-lib.Google Android supplies the Tinyalsa.Audio HAL interface forms changed in Android 4.0.

    *