Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Android Audio System
Search
Sam Huang
August 31, 2020
Programming
1
440
Android Audio System
Sam Huang
August 31, 2020
Tweet
Share
More Decks by Sam Huang
See All by Sam Huang
從開發走向管理及規劃 — 工程師的自我修養
sailplanetw
0
170
軟體的成本預估與時程規劃
sailplanetw
0
140
全方位技術整合:專業開發能力成就完善的智能平台
sailplanetw
0
190
從案例看製造業如何做數位轉型
sailplanetw
0
140
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
160
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
520
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
220
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
360
感官文化印刷的全通路品牌營運策略
sailplanetw
0
280
Other Decks in Programming
See All in Programming
CSC307 Lecture 09
javiergs
PRO
1
830
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
230
Package Management Learnings from Homebrew
mikemcquaid
0
210
CSC307 Lecture 05
javiergs
PRO
0
500
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
0
910
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
150
AI & Enginnering
codelynx
0
110
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
680
Oxlintはいいぞ
yug1224
5
1.3k
AWS re:Invent 2025参加 直前 Seattle-Tacoma Airport(SEA)におけるハードウェア紛失インシデントLT
tetutetu214
2
100
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6k
Featured
See All Featured
Practical Orchestrator
shlominoach
191
11k
[SF Ruby Conf 2025] Rails X
palkan
0
740
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
200
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
140
HDC tutorial
michielstock
1
360
How to Think Like a Performance Engineer
csswizardry
28
2.4k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
Unsuck your backbone
ammeep
671
58k
What's in a price? How to price your products and services
michaelherold
247
13k
Writing Fast Ruby
sferik
630
62k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
Transcript
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 7 Linux Driver Audio HAL Android Framework
Java App
Android Audio System 8 app AudioTrack/AudioRecord/… (AudioPolicy/AudioFlinger/…) Audio HAL (open/read/write/…)
Audio Driver control flow data flow p c m d a t a Audio Policy Audio Flinger
Audio Framework 9
Audio Framework 10 router receiver 1 sender 1 Network Packet
Routing sender 2 sender 3 sender 4 receiver 2 receiver 3 Routing path
Audio Framework 11 Audio Policy Hardware 1 AudioTrack 1 Audio
Routing (play audio) Hardware 2 Hardware 3 Audio Flinger AudioTrack 2 AudioTrack 3 AudioTrack 4 Java App 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 Platform Group 18 app AudioTrack/AudioRecord/… (AudioPolicy/AudioFlinger/…) Audio HAL
(open/read/write/…) Audio Driver
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