SlideShare a Scribd company logo
1 of 19
Android Audio System
Introduction
Outline
•
•
•
•

Background
Android Audio System
Audio Framework
Audio HAL

2
Background
3
Background
• Information about this slide
• Software
• Android 4.0/4.2

4
Android Audio System
5
Architecture Audio System
• The complexity of android audio system
• Soft real-time requirement
• Large number of usage scenarios
• Software
• phone/media player/…
• different volume setting/…

• Hardware
• earpiece/speaker/hdmi/…
• mic/bluetooth/…

• Flexibility design
• good design pattern
• performance (Java/JNI/binder/…)
6
Architecture Audio System
Java App

Android Framework

Audio HAL

Linux Driver
7
Android Audio System
pcm data
app
data flow
control flow
AudioTrack/AudioRecord/…
(AudioPolicy/AudioFlinger/…)

Audio
Policy

Audio
Flinger

Audio HAL
(open/read/write/…)

Audio Driver
8
Audio Framework
9
Audio Framework
Network Packet Routing

sender 1

router

receiver 1

sender 2
Routing path

receiver 2

sender 3
receiver 3
sender 4

10
Audio Framework
Audio Routing (play audio)

AudioTrack 1

Audio
Policy

Hardware 1

AudioTrack 2
Audio Flinger

Hardware 2

AudioTrack 3
Hardware 3

AudioTrack 4

Java App

11

Audio Framework
Audio HAL
Audio Policy
• Decide which thread in AudioFlinger should sound be
attached.
• stream  strategy  output
• stream : VOICE_CALL, TTS, MUSIC, …
• strategy : PHONE, MUSIC, …
• output : a thread in AudioFlinger

• strategy : bridge between software data stream and hardware

12
Audio Policy

13
Audio Policy
• IOProfile (audio_policy.conf)
• Content
• Define all the possible I/O devices
• Define default I/O device

• Hierarchical structure
• hardware module
• profile
• sampling_rates/channels/formats/devices/flags

• With IOProfile, audio policy gets better OO structure.

14
Audio Policy

15
Audio Flinger
• Several thread to read/write data
• Create thread by AudioPolicy
• mixer thread
• duplicating thread
• direct output thread

• Resampler
• Non-blocking audio I/O
• AudioWatchdog

16
Audio HAL
17
Audio HAL
app

AudioTrack/AudioRecord/…
(AudioPolicy/AudioFlinger/…)

Audio HAL
(open/read/write/…)

Audio Driver
18
Audio HAL
• ALSA (Advanced Linux Sound Architecture)
• unified interface/SMP/thread-safe/…
• usespace library
• alsa-lib
• tinyalsa

• tinyplay/tinycap/ tinymix

• Audio HAL interface
• volume setting
• I/O function
• …
19

More Related Content

What's hot

Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Opersys inc.
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
Utkarsh Mankad
 
Android audio system(오디오 플링거 서비스 초기화)
Android audio system(오디오 플링거 서비스 초기화)Android audio system(오디오 플링거 서비스 초기화)
Android audio system(오디오 플링거 서비스 초기화)
fefe7270
 
Android audio system(오디오 출력-트랙생성)
Android audio system(오디오 출력-트랙생성)Android audio system(오디오 출력-트랙생성)
Android audio system(오디오 출력-트랙생성)
fefe7270
 

What's hot (20)

Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
MediaPlayer Playing Flow
MediaPlayer Playing FlowMediaPlayer Playing Flow
MediaPlayer Playing Flow
 
Android device driver structure introduction
Android device driver structure introductionAndroid device driver structure introduction
Android device driver structure introduction
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Android media framework overview
Android media framework overviewAndroid media framework overview
Android media framework overview
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security Internals
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
Audio Drivers
Audio DriversAudio Drivers
Audio Drivers
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Android audio system(오디오 플링거 서비스 초기화)
Android audio system(오디오 플링거 서비스 초기화)Android audio system(오디오 플링거 서비스 초기화)
Android audio system(오디오 플링거 서비스 초기화)
 
Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
Android Multimedia Framework
Android Multimedia FrameworkAndroid Multimedia Framework
Android Multimedia Framework
 
Android audio system(오디오 출력-트랙생성)
Android audio system(오디오 출력-트랙생성)Android audio system(오디오 출력-트랙생성)
Android audio system(오디오 출력-트랙생성)
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UI
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
 

Similar to Android Audio System

Podcasting sfrome2011 by Maria Grazia Bovo (FAO)
Podcasting sfrome2011 by Maria Grazia Bovo (FAO)Podcasting sfrome2011 by Maria Grazia Bovo (FAO)
Podcasting sfrome2011 by Maria Grazia Bovo (FAO)
ShareFair
 
Ig2 task 1 work sheet - JS
Ig2 task 1 work sheet - JSIg2 task 1 work sheet - JS
Ig2 task 1 work sheet - JS
JamieShepherd
 
Portinig Application, Drivers And Os
Portinig Application, Drivers And OsPortinig Application, Drivers And Os
Portinig Application, Drivers And Os
momobangalore
 
Flexible and Transparent Multimedia Routing on OSGi Environments - Dr. Nativi...
Flexible and Transparent Multimedia Routing on OSGi Environments - Dr. Nativi...Flexible and Transparent Multimedia Routing on OSGi Environments - Dr. Nativi...
Flexible and Transparent Multimedia Routing on OSGi Environments - Dr. Nativi...
mfrancis
 
Jordan smith ig2 task 1 revisited
Jordan smith ig2 task 1 revisitedJordan smith ig2 task 1 revisited
Jordan smith ig2 task 1 revisited
JordanSmith96
 
Shaun Warburton IG2 task 1
Shaun Warburton IG2 task 1 Shaun Warburton IG2 task 1
Shaun Warburton IG2 task 1
warburton9191
 
Developing Applications Using Host Processing Instead of DSPs
Developing Applications Using Host Processing Instead of DSPsDeveloping Applications Using Host Processing Instead of DSPs
Developing Applications Using Host Processing Instead of DSPs
Videoguy
 

Similar to Android Audio System (20)

Deep dive into Android’s audio latency problem
Deep dive into Android’s audio latency problemDeep dive into Android’s audio latency problem
Deep dive into Android’s audio latency problem
 
Android Multimedia Player Project Presentation
Android Multimedia Player Project PresentationAndroid Multimedia Player Project Presentation
Android Multimedia Player Project Presentation
 
Podcasting sfrome2011 by Maria Grazia Bovo (FAO)
Podcasting sfrome2011 by Maria Grazia Bovo (FAO)Podcasting sfrome2011 by Maria Grazia Bovo (FAO)
Podcasting sfrome2011 by Maria Grazia Bovo (FAO)
 
Eugen Constantinescu - Genivi - Codecamp 10 may 2014
Eugen Constantinescu - Genivi - Codecamp 10 may 2014Eugen Constantinescu - Genivi - Codecamp 10 may 2014
Eugen Constantinescu - Genivi - Codecamp 10 may 2014
 
Sound recording glossary by Liam Oven for Unit 73
Sound recording glossary by Liam Oven for Unit 73Sound recording glossary by Liam Oven for Unit 73
Sound recording glossary by Liam Oven for Unit 73
 
2012 djb software_features & topology
2012 djb software_features & topology2012 djb software_features & topology
2012 djb software_features & topology
 
JAVA Media Player
JAVA Media PlayerJAVA Media Player
JAVA Media Player
 
Ig2 task 1 work sheet - JS
Ig2 task 1 work sheet - JSIg2 task 1 work sheet - JS
Ig2 task 1 work sheet - JS
 
WebRTC Browsers n Stacks Implementation differences
WebRTC Browsers n Stacks Implementation differencesWebRTC Browsers n Stacks Implementation differences
WebRTC Browsers n Stacks Implementation differences
 
Multimedia on android
Multimedia on androidMultimedia on android
Multimedia on android
 
Portinig Application, Drivers And Os
Portinig Application, Drivers And OsPortinig Application, Drivers And Os
Portinig Application, Drivers And Os
 
Flexible and Transparent Multimedia Routing on OSGi Environments - Dr. Nativi...
Flexible and Transparent Multimedia Routing on OSGi Environments - Dr. Nativi...Flexible and Transparent Multimedia Routing on OSGi Environments - Dr. Nativi...
Flexible and Transparent Multimedia Routing on OSGi Environments - Dr. Nativi...
 
Jordan smith ig2 task 1 revisited
Jordan smith ig2 task 1 revisitedJordan smith ig2 task 1 revisited
Jordan smith ig2 task 1 revisited
 
Personnalisation d'Android par Archos 26-10-2011 au PAUG
Personnalisation d'Android par Archos 26-10-2011 au PAUGPersonnalisation d'Android par Archos 26-10-2011 au PAUG
Personnalisation d'Android par Archos 26-10-2011 au PAUG
 
Multimedia in Higher Education
Multimedia in Higher EducationMultimedia in Higher Education
Multimedia in Higher Education
 
FxOS Audio Playback 101
FxOS Audio Playback 101FxOS Audio Playback 101
FxOS Audio Playback 101
 
Shaun Warburton IG2 task 1
Shaun Warburton IG2 task 1 Shaun Warburton IG2 task 1
Shaun Warburton IG2 task 1
 
Developing Applications Using Host Processing Instead of DSPs
Developing Applications Using Host Processing Instead of DSPsDeveloping Applications Using Host Processing Instead of DSPs
Developing Applications Using Host Processing Instead of DSPs
 
Introducing Android Media Player
Introducing Android Media PlayerIntroducing Android Media Player
Introducing Android Media Player
 
Video Streaming: Broadcast quality on a shoe string budget.
Video Streaming: Broadcast quality on a shoe string budget.  Video Streaming: Broadcast quality on a shoe string budget.
Video Streaming: Broadcast quality on a shoe string budget.
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Android Audio System

Editor's Notes

  1. 以前 Mint 有報告過 只講有改到的地方 不講 code,只分享概念
  2. 有些能關有些不能關 有新裝置時聲音要轉移 同一個東西在不同地方有不同名稱 裝置有 FM 7.1 聲道
  3. 只講 play 部份,record 反之亦然 有其他諸如 Audio System 之類的裝置管理沒講
  4. 4.0 -> 4.2 自 7xxx ~ 9xxx (Leo 3926) 相關的自 14xxx ~ 20xxx TODO : 5 ~ 9 FIXME : 4 ~ 28
  5. 1. The original version is provided from SoC vendor. 2. Dynamic library linked by AudioFlinger.
  6. Why use Tinyalsa We can use ALSA-lib substitute for Tinyalsacompletely, but we can’t 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.