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
260
Android Audio System
Sam Huang
August 31, 2020
Tweet
Share
More Decks by Sam Huang
See All by Sam Huang
從案例看製造業如何做數位轉型
sailplanetw
0
2
案例分享:台塑生醫實驗用藥追蹤系統
sailplanetw
0
2
[MOPCON 2022 Keynote] 從 IoT 到 Web2,從 Web2 到 Web3:那些開發路上的奇妙風景
sailplanetw
0
290
Offline x Online:HiPrint Smart Printing E-Commerce System
sailplanetw
0
190
從 APP 到雲端:物聯網產品的軟體設計該如何規劃
sailplanetw
0
220
感官文化印刷的全通路品牌營運策略
sailplanetw
0
160
傳統與創新的碰撞:富士軟片資訊的趨勢觀察及未來展望
sailplanetw
0
170
淺談印刷文創與資訊技術的融合
sailplanetw
0
170
數位加速聽看聽 - 讓資訊技術成為印刷領域升級的最佳助手
sailplanetw
0
140
Other Decks in Programming
See All in Programming
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
26
8.2k
Snowflakeで眠ったデータを起こそう!
estie
0
120
Git Rebase
bkuhlmann
11
1.6k
Tailwind CSSを本気でカスタマイズする方法
fsubal
13
5.2k
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
110
SIMD Parallel Programming with the Vector API
josepaumard
0
160
ONE WEDGE_company_guide
1wedge_one
0
470
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
670
Code Reviews
bkuhlmann
4
890
使ってみよう Azure AI Document Intelligence
kosmosebi
2
300
[技育CAMPアカデミア]アイディアを形に!【超入門】スマホアプリ開発〜リリースまでの流れをご紹介
teamlab
PRO
0
370
try!Swift Tokyo 2024 参加報告 LT
akidon0000
1
220
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
Six Lessons from altMBA
skipperchong
21
3k
The Cult of Friendly URLs
andyhume
74
5.7k
The Art of Programming - Codeland 2020
erikaheidi
42
12k
StorybookのUI Testing Handbookを読んだ
zakiyama
13
4.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
121
39k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
244
20k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
40
4.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
125
32k
Scaling GitHub
holman
457
140k
10 Git Anti Patterns You Should be Aware of
lemiorhan
648
58k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.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