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
0
280
Android Audio System
Sam Huang
August 31, 2020
Tweet
Share
More Decks by Sam Huang
See All by Sam Huang
全方位技術整合:專業開發能力成就完善的智能平台
sailplanetw
0
34
從案例看製造業如何做數位轉型
sailplanetw
0
14
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
19
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
350
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
200
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
250
感官文化印刷的全通路品牌營運策略
sailplanetw
0
180
傳統與創新的碰撞:富士軟片資訊的趨勢觀察及未來展望
sailplanetw
0
200
淺談印刷文創與資訊技術的融合
sailplanetw
0
200
Other Decks in Programming
See All in Programming
わかりやすい正解を捨てて、コトに向き合う - スクラムフェス金沢2024 スポンサーセッション
yusukekokubo
0
170
Rubyのパフォーマンスプロファイリングの改善 / Enhancing performance profiling for Ruby
osyoyu
1
410
SRE チーム立ち上げ前に考えたこと・取り組んだこと / Considerations and Preparations Before Establishing an SRE Team
mackey0225
3
320
I/O Extended Android in Korea 2024 ~ Whats new in Android development tools
pluu
0
250
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Berlin
prof18
0
110
「2024年版 Kotlin サーバーサイドプログラミング実践開発」の補講 〜O/Rマッパー編〜
n_takehata
2
260
Composing an API the *right* way (Droidcon Berlin 2024)
zsmb
1
450
CSC307 Lecture 13
javiergs
PRO
0
150
継続的な活動で築く地方エンジニアの道
myamashii
2
350
DMMプラットフォームにおけるTiDBの導入から運用まで
pospome
7
3k
Namespace on read
tagomoris
2
370
DynamoDB コスト最適化っぽいことの基本 with Terraform
kuro_kurorrr
2
250
Featured
See All Featured
A Tale of Four Properties
chriscoyier
155
22k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
18
1.2k
In The Pink: A Labor of Love
frogandcode
139
22k
How GitHub (no longer) Works
holman
305
140k
Learning to Love Humans: Emotional Interface Design
aarron
269
39k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
121
18k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
The Mythical Team-Month
searls
217
43k
Music & Morning Musume
bryan
43
5.9k
Navigating Team Friction
lara
181
13k
How To Stay Up To Date on Web Technology
chriscoyier
784
250k
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