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
1
310
Android Audio System
Sam Huang
August 31, 2020
Tweet
Share
More Decks by Sam Huang
See All by Sam Huang
軟體的成本預估與時程規劃
sailplanetw
0
84
全方位技術整合:專業開發能力成就完善的智能平台
sailplanetw
0
83
從案例看製造業如何做數位轉型
sailplanetw
0
53
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
61
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
410
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
200
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
280
感官文化印刷的全通路品牌營運策略
sailplanetw
0
210
傳統與創新的碰撞:富士軟片資訊的趨勢觀察及未來展望
sailplanetw
0
240
Other Decks in Programming
See All in Programming
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
5
1.8k
WEBエンジニア向けAI活用入門
sutetotanuki
0
310
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
1.1k
Synchronizationを支える技術
s_shimotori
1
150
Quine, Polyglot, 良いコード
qnighy
4
550
Googleのテストサイズを活用したテスト環境の構築
toms74209200
0
290
Amazon Neptuneで始めてみるグラフDB-OpenSearchによるグラフの全文検索-
satoshi256kbyte
4
350
Honoの来た道とこれから
yusukebe
19
3.1k
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
410
破壊せよ!データ破壊駆動で考えるドメインモデリング / data-destroy-driven
minodriven
16
4.2k
Identifying User Idenity
moro
6
8.7k
Modern Angular: Renovation for Your Applications
manfredsteyer
PRO
0
230
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
31
1.5k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
Ruby is Unlike a Banana
tanoku
96
11k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
[RailsConf 2023] Rails as a piece of cake
palkan
51
4.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
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