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
410
Android Audio System
Sam Huang
August 31, 2020
Tweet
Share
More Decks by Sam Huang
See All by Sam Huang
從開發走向管理及規劃 — 工程師的自我修養
sailplanetw
0
150
軟體的成本預估與時程規劃
sailplanetw
0
130
全方位技術整合:專業開發能力成就完善的智能平台
sailplanetw
0
180
從案例看製造業如何做數位轉型
sailplanetw
0
120
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
140
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
490
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
220
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
350
感官文化印刷的全通路品牌營運策略
sailplanetw
0
270
Other Decks in Programming
See All in Programming
Developer Joy - The New Paradigm
hollycummins
1
260
スマホから Youtube Shortsを見られないようにする
lemolatoon
27
33k
開発生産性を上げるための生成AI活用術
starfish719
3
1.5k
CSC305 Lecture 08
javiergs
PRO
0
250
他言語経験者が Golangci-lint を最初のコーディングメンターにした話 / How Golangci-lint Became My First Coding Mentor: A Story from a Polyglot Programmer
uma31
0
310
EMこそClaude Codeでコード調査しよう
shibayu36
0
250
Cursorハンズオン実践!
eltociear
2
1.2k
コード生成なしでモック処理を実現!ovechkin-dm/mockioで学ぶメタプログラミング
qualiarts
0
170
What's new in Spring Modulith?
olivergierke
1
160
チームの境界をブチ抜いていけ
tokai235
0
200
AI駆動で0→1をやって見えた光と伸びしろ
passion0102
1
590
Six and a half ridiculous things to do with Quarkus
hollycummins
0
190
Featured
See All Featured
A Tale of Four Properties
chriscoyier
161
23k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
The Language of Interfaces
destraynor
162
25k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Fireside Chat
paigeccino
40
3.7k
Navigating Team Friction
lara
190
15k
A better future with KSS
kneath
239
18k
Scaling GitHub
holman
463
140k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.1k
Optimizing for Happiness
mojombo
379
70k
Typedesign – Prime Four
hannesfritz
42
2.8k
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