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
300
Android Audio System
Sam Huang
August 31, 2020
Tweet
Share
More Decks by Sam Huang
See All by Sam Huang
全方位技術整合:專業開發能力成就完善的智能平台
sailplanetw
0
74
從案例看製造業如何做數位轉型
sailplanetw
0
45
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
48
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
390
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
200
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
270
感官文化印刷的全通路品牌營運策略
sailplanetw
0
200
傳統與創新的碰撞:富士軟片資訊的趨勢觀察及未來展望
sailplanetw
0
230
淺談印刷文創與資訊技術的融合
sailplanetw
0
220
Other Decks in Programming
See All in Programming
tsconfig.jsonの最近の新機能 ファイルパス編
uhyo
7
1.8k
20241004 モノタロウ式~ドメインモデリングとリアーキテクチャ
monotaro
PRO
2
390
[PHPカンファレンス沖縄2024]「無理なくできるだけ安全に」テストもないレガシーコードをリファクタリングするテクニック
ikezoemakoto
3
130
CSC509 Lecture 04
javiergs
PRO
0
150
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
1.2k
DjangoNinjaで高速なAPI開発を実現する
masaya00
1
540
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
480
Kubernetes上でOracle_Databaseの運用を楽にするOraOperatorの紹介
nnaka2992
0
160
Progressive Web Apps for Rails developers
siaw23
2
560
UnJSで簡単に始めるCLIツール開発 / cli-tool-development-with-unjs
aoseyuu
2
340
Jakarta EE as Seen Trough the Lens of the ASF
ivargrimstad
0
380
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
190
Featured
See All Featured
Web development in the modern age
philhawksworth
205
10k
Why Our Code Smells
bkeepers
PRO
334
57k
Design by the Numbers
sachag
278
19k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Designing for Performance
lara
604
68k
GraphQLの誤解/rethinking-graphql
sonatard
65
9.9k
4 Signs Your Business is Dying
shpigford
180
21k
In The Pink: A Labor of Love
frogandcode
139
22k
Happy Clients
brianwarren
97
6.7k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
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