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
450
Android Audio System
Sam Huang
August 31, 2020
Tweet
Share
More Decks by Sam Huang
See All by Sam Huang
從開發走向管理及規劃 — 工程師的自我修養
sailplanetw
0
180
軟體的成本預估與時程規劃
sailplanetw
0
150
全方位技術整合:專業開發能力成就完善的智能平台
sailplanetw
0
200
從案例看製造業如何做數位轉型
sailplanetw
0
150
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
160
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
520
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
230
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
370
感官文化印刷的全通路品牌營運策略
sailplanetw
0
280
Other Decks in Programming
See All in Programming
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
270
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
770
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
220
DSPy入門 Pythonで実現する自動プロンプト最適化 〜人手によるプロンプト調整からの卒業〜
seaturt1e
1
690
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
15
8.6k
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1k
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
190
Ruby and LLM Ecosystem 2nd
koic
1
590
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.3k
AIコーディングの理想と現実 2026 | AI Coding: Expectations vs. Reality 2026
tomohisa
0
1.2k
株式会社 Sun terras カンパニーデック
sunterras
0
2.1k
AI時代のソフトウェア開発でも「人が仕様を書く」から始めよう-医療IT現場での実践とこれから
koukimiura
0
140
Featured
See All Featured
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
210
Prompt Engineering for Job Search
mfonobong
0
180
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
350
Paper Plane (Part 1)
katiecoart
PRO
0
5.5k
Practical Orchestrator
shlominoach
191
11k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
950
Thoughts on Productivity
jonyablonski
75
5.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
260
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
67
37k
For a Future-Friendly Web
brad_frost
183
10k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.4k
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