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
490
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Android Audio System
Sam Huang
August 31, 2020
More Decks by Sam Huang
See All by Sam Huang
從開發走向管理及規劃 — 工程師的自我修養
sailplanetw
0
220
軟體的成本預估與時程規劃
sailplanetw
0
170
全方位技術整合:專業開發能力成就完善的智能平台
sailplanetw
0
240
從案例看製造業如何做數位轉型
sailplanetw
0
200
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
190
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
570
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
240
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
400
感官文化印刷的全通路品牌營運策略
sailplanetw
0
320
Other Decks in Programming
See All in Programming
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
200
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
330
メールのエイリアス機能を履き違えない
isshinfunada
0
210
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
180
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
210
FDEが実現するAI駆動経営の現在地
gonta
2
250
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
200
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
380
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
160
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
460
テーブルをDELETEした
yuzneri
0
130
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
150
Featured
See All Featured
Context Engineering - Making Every Token Count
addyosmani
9
1k
How GitHub (no longer) Works
holman
316
150k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.7k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
890
Facilitating Awesome Meetings
lara
57
7.1k
Skip the Path - Find Your Career Trail
mkilby
1
180
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
350
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
650
The SEO Collaboration Effect
kristinabergwall1
1
510
Speed Design
sergeychernyshev
33
2k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.3k
Practical Orchestrator
shlominoach
191
12k
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