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
Picking up the pieces - Overcoming Device Fragm...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Jan Berkel
October 26, 2012
Programming
1
250
Picking up the pieces - Overcoming Device Fragmentation
Talk given at Droidcon London, Oct 2012. Jan Berkel and Jon Schmidt.
Jan Berkel
October 26, 2012
Tweet
Share
Other Decks in Programming
See All in Programming
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
CSC307 Lecture 09
javiergs
PRO
1
840
ノイジーネイバー問題を解決する 公平なキューイング
occhi
0
110
ぼくの開発環境2026
yuzneri
0
240
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
Raku Raku Notion 20260128
hareyakayuruyaka
0
350
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.6k
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
180
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
460
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
270
Featured
See All Featured
For a Future-Friendly Web
brad_frost
182
10k
Technical Leadership for Architectural Decision Making
baasie
2
250
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.1k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
What does AI have to do with Human Rights?
axbom
PRO
0
2k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.6k
Prompt Engineering for Job Search
mfonobong
0
160
Designing for humans not robots
tammielis
254
26k
Evolving SEO for Evolving Search Engines
ryanjones
0
130
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Transcript
Overcoming Device Fragmentation Jan Berkel Jon Schmidt
• Launched in 2008 • Upload, record, share original audio
content • Receive feedback from the community directly on the waveform • 10+ million official app installs over all platforms “Unmute the web”
SoundCloud on Android Connect to and receive updates from your
account. Discover, listen, and interact with SoundCloud’s library of audio.
SoundCloud on Android Record sounds to your Android device, then
upload and share to SoundCloud.
Playback + Recording Core functionality of the app
LESSONS LEARNED: PLAYBACK
v1.0
“Love it” “Why does this app suck so bad?”
“There was a problem playing that Sound” SoundCloud on Android
(2010 -?)
MediaPlayer player = new MediaPlayer(); player.setDataSource( "http://api.soundcloud.com/tracks/123/stream" ); player.prepare(); player.start();
player.start() MediaPlayer App Framework mediaplayer.cpp libmedia MediaPlayerService AudioTrack audiotrack.cpp Audio
Flinger / HAL ALSA? Kernel SoundCloud Java C / C++
OpenCore MediaPlayerService Stagefright
“All non-trivial abstractions, to some degree, are leaky” J Spolsky
Why do we have to care?
OpenCore Since the beginning Mature, stable, but limited
OpenCORE seeking is broken
Stagefright Default on Android 2.2 and beyond (but OpenCore support
continued)
We support Android 2.1 +
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD) { isStagefright = true; } That
should be easy Not exactly...
[media.stagefright.enable-player]: [false] [media.stagefright.enable-meta]: [false] [media.stagefright.enable-scan]: [false] [media.stagefright.enable-http]: [true] [media.stagefright.enable-rtsp]: [false]
/system/build.prop
Frankenstein Builds
MediaPlayer mp = new MediaPlayer(); mp.setDataSource(String.format("http://127.0.0.1:%d/", socketPort)); mp.prepare(); mp.start(); Connect
to a Local Socket if (res.indexOf("User-Agent: stagefright") >= 0) { isStagefright = true; } Read the user agent
v2.0
Stream Proxy MediaPlayer Stream Proxy Connection Manager Data Storage Socket
Manager Chunk Manager
if (mProxy == null) { mProxy = new StreamProxy(getApp()).init().start(); }
mMediaPlayer.setDataSource( String.format("http://127.0.0.1:%d/%s", mProxy.getPort(), path) ); http://code.google.com/p/npr-android-app Stream Proxy
• Control the connection logic • caching layer The Good
The Bad • Still no control over buffer • Introduced new streaming problems Stream Proxy
HTTP CLIENT Y U NO WORK!? HttpClient is broken
try { return getHttpClient().execute(target, request); } catch (NullPointerException e) {
request.abort(); throw new BrokenHttpClientException(e); } HttpClient is broken
• Write our own MediaPlayer • Request prioritization • Mobile
friendly codecs Plans for the future
“this is an experimental feature and might not work on
all devices”
LESSONS LEARNED: RECORDING
AUDIO CODEC CODER-DECODER mp3, aac, flac, ogg ...
December 2010 available codecs on Android... AMR NB
record raw audio, encode later.
open source, no patents, good quality Java port = slow
Second Iteration AAC
if (Build.SDK_INT >= 10) // use built-in AAC else //
slow vorbis encoding Only available on 2.3.3
and everything was good. until we had to rewrite.
NEW RECORDING
REQUIREMENTS user is able to trim fade in/out
REQUIREMENTS pause recording and resume later more accurate waveform
We needed a new recording infrastructure.
AudioRecord Sound Recorder Vorbis Encoder Amplitude Analyzer Vorbis Decoder Native
Layer ̇⽃ AudioTrack
arm-v5 CPU flavours arm-v7a x86 mips
AudioRecord Sound Recorder Vorbis Encoder Amplitude Analyzer Vorbis Decoder Native
Layer ̇⽃ AudioTrack Wav Writer
JellyBean new low-level media APIs
Device API Level CPU Fragmentation
Putting it back together
CRASH REPORTS
BETA TESTING
READ THE SOURCE CODE
HACKS
DO IT YOURSELF
Jan Berkel Jon Schmidt http://snd.sc/droidcon-2012 www.soundcloud.com Thanks!