Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Picking up the pieces - Overcoming Device Fragm...
Search
Jan Berkel
October 26, 2012
Programming
260
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Picking up the pieces - Overcoming Device Fragmentation
Talk given at Droidcon London, Oct 2012. Jan Berkel and Jon Schmidt.
Jan Berkel
October 26, 2012
Other Decks in Programming
See All in Programming
最近”作らせてる” ローカルAIアプリの話
akit37
0
470
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
0
1.2k
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1.2k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
410
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
370
Event is what happens
moro
2
780
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
150
残高管理から台帳サービスへの進化
artoy
1
200
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
120
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1369
210k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Faster Mobile Websites
deanohume
310
32k
Raft: Consensus for Rubyists
vanstee
142
7.8k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
730
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.4k
First, design no harm
axbom
PRO
2
1.3k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
520
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
410
Are puppies a ranking factor?
jonoalderson
2
4.1k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
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!