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
460
1
Share
Android Audio System
Sam Huang
August 31, 2020
More Decks by Sam Huang
See All by Sam Huang
從開發走向管理及規劃 — 工程師的自我修養
sailplanetw
0
180
軟體的成本預估與時程規劃
sailplanetw
0
150
全方位技術整合:專業開發能力成就完善的智能平台
sailplanetw
0
200
從案例看製造業如何做數位轉型
sailplanetw
0
160
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
170
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
530
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
230
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
370
感官文化印刷的全通路品牌營運策略
sailplanetw
0
290
Other Decks in Programming
See All in Programming
飯MCP
yusukebe
0
480
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
440
Don't Prompt Harder, Structure Better
kitasuke
0
210
AIと共にエンジニアとPMの “二刀流”を実現する
naruogram
0
130
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
540
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
170
Going Multiplatform with Your Android App (Android Makers 2026)
zsmb
2
340
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
160
Feature Toggle は捨てやすく使おう
gennei
0
430
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
3
510
Geminiをパートナーに神社DXシステムを個人開発した話(いなめぐDX 開発振り返り)
fujiba
0
140
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.8k
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Typedesign – Prime Four
hannesfritz
42
3k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
340
Context Engineering - Making Every Token Count
addyosmani
9
800
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
Code Review Best Practice
trishagee
74
20k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
500
Evolving SEO for Evolving Search Engines
ryanjones
0
170
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
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