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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
290
Other Decks in Programming
See All in Programming
ふつうのRubyist、ちいさなデバイス、大きな一年 / Ordinary Rubyists, Tiny Devices, Big Year
chobishiba
1
480
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
190
Migration to Signals, Signal Forms, Resource API, and NgRx Signal Store @Angular Days 03/2026 Munich
manfredsteyer
PRO
0
100
Windows on Ryzen and I
seosoft
0
330
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
150
Understanding Apache Lucene - More than just full-text search
spinscale
0
130
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
200
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
1.8k
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
310
AI 開発合宿を通して得た学び
niftycorp
PRO
0
150
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
140
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
400
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
110
The Cult of Friendly URLs
andyhume
79
6.8k
Typedesign – Prime Four
hannesfritz
42
3k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Raft: Consensus for Rubyists
vanstee
141
7.4k
GraphQLとの向き合い方2022年版
quramy
50
14k
sira's awesome portfolio website redesign presentation
elsirapls
0
190
Code Review Best Practice
trishagee
74
20k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
130
The SEO Collaboration Effect
kristinabergwall1
0
400
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
240
AI: The stuff that nobody shows you
jnunemaker
PRO
3
450
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