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
470
1
Share
Android Audio System
Sam Huang
August 31, 2020
More Decks by Sam Huang
See All by Sam Huang
從開發走向管理及規劃 — 工程師的自我修養
sailplanetw
0
200
軟體的成本預估與時程規劃
sailplanetw
0
150
全方位技術整合:專業開發能力成就完善的智能平台
sailplanetw
0
220
從案例看製造業如何做數位轉型
sailplanetw
0
170
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
170
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
540
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
230
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
380
感官文化印刷的全通路品牌營運策略
sailplanetw
0
300
Other Decks in Programming
See All in Programming
GoogleCloudとterraform完全に理解した
terisuke
1
190
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
420
Spec-Driven Development with AI Agents (Workshop, May 2026)
antonarhipov
3
340
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.2k
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
150
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
630
KMP × Kotlin 2.3 - How Android Got Slower While iOS Builds Improved by 47%
rio432
0
170
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
350
tRPCの概要と少しだけパフォーマンス
misoton665
2
270
要はバランスからの卒業 #yumemi_grow
kajitack
0
150
「OSSがあるなら自作するな」は AI時代も正しいか ── Build vs Adopt の新しい判断基準
kumorn5s
7
2.6k
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.8k
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
174
15k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
230
My Coaching Mixtape
mlcsv
0
120
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
210
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
1
48
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
270
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