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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Sam Huang
August 31, 2020
Programming
480
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
210
軟體的成本預估與時程規劃
sailplanetw
0
160
全方位技術整合:專業開發能力成就完善的智能平台
sailplanetw
0
230
從案例看製造業如何做數位轉型
sailplanetw
0
180
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
180
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
550
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
230
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
390
感官文化印刷的全通路品牌營運策略
sailplanetw
0
310
Other Decks in Programming
See All in Programming
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
160
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
320
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
260
Webフレームワークの ベンチマークについて
yusukebe
0
160
AI時代の仕事技芸論 — ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ
kuranuki
2
660
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.3k
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
190
ふつうのFeature Flag実践入門
irof
7
3.7k
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
6.5k
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
270
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
230
OSもどきOS
arkw
0
550
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
580
Test your architecture with Archunit
thirion
1
2.3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Side Projects
sachag
455
43k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.6k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
530
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.5k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
130
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
240
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