Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
martinlong78
Old
#1  
Senior Member - OP
Thanks Meter 0
Posts: 134
Join Date: Aug 2007
Default Wake lock / CPU / Music issues when sleeping.

I'm having some real trouble with music on ICS, when the screen is switched off.

Here are the conditions:

1. My app uses a MediaPlayer to play music.
2. My app holds a PARTIAL_WAKE_LOCK to keep the CPU awake.
3. I'm running a foreground service. It is very interactive with the user (via TTS and music) for about 30 mins. Mustn't be killed, and is tracking GPS updates and doing lots of stuff.

When the screen is switched off with the power button, the music starts to stutter. Not ALL tracks, but I've found a few with a 320 bitrate that have this issue.

I've noticed some interesting stuff.

When the screen is on:

(first line is the media service, second is my app.. they are the top 2 processes)

PID PR CPU% S #THR VSS RSS PCY UID Name
119 0 6% S 12 45484K 5780K fg media /system/bin/mediaserver
8852 1 4% S 23 493580K 65700K fg app_98 com.rundouble.companion


(When the screen is turned off (and the stuttering starts)

PID PR CPU% S #THR VSS RSS PCY UID Name
119 0 5% S 12 45484K 5780K fg media /system/bin/mediaserver

My app drops right off the screen (down to 0%) which I don't understand because I have a wake lock. But also the mediaserver reliably and reproducably drops to 5%. I suspect this is related to the stuttering.

Now, in the Google Music player the SAME HAPPENS, unless I turn on the "Sound Effect" option. However, I don't have API access to this from my app, so I can't turn it on. However, the fact that the Google Music app does the same suggests this is a bug with the MediaPlayer.

Any Ideas?

Thanks

Martin
 
minooch
Old
#2  
minooch's Avatar
Senior Member
Thanks Meter 1411
Posts: 639
Join Date: Oct 2008

 
DONATE TO ME
Hmm,

Posting in the correct area is a good start!

What rom & radio are you using?
 
franciscofranco
Old
#3  
franciscofranco's Avatar
Recognized Developer
Thanks Meter 44509
Posts: 10,334
Join Date: Dec 2010
Location: Mountain View, CA

 
DONATE TO ME
If you're using 350mhz as minimum frequency can you turn it up to 500mhz and see if it helps anything?
franco.Kernel - Galaxy Nexus
franco.Kernel - Nexus 4
franco.Kernel - Nexus 7
franco.Kernel - Nexus 10


Google+ | Twitter | Portfolio

CruzerLite franco.Kernel case for the Nexus 4
CruzerLite franco.Kernel case for the Galaxy Nexus

You don't like my reply? Read this

However, if you put any trust in Quadrant scores you could use them to prove that dancing naked for 5 minutes in your garden affects device performance. By Chainfire
The Following User Says Thank You to franciscofranco For This Useful Post: [ Click to Expand ]
 
Superfrag
Old
#4  
Superfrag's Avatar
Senior Member
Thanks Meter 6
Posts: 325
Join Date: Jul 2010
Location: Erie
The same thing is happening to me when I was listening to music the other day, using PowerAMP. Moment the phone goes to sleep, the music starts stuttering. Annoying.
Galaxy Nexus | HTC Sensation | Nexus S | Galaxy Tab 10.1 32GB I/O
My Last.fm Page
My Twitter!
"We all got our choices to make." "Damn Shame."
 
@rbiter
Old
#5  
@rbiter's Avatar
Senior Member
Thanks Meter 723
Posts: 3,041
Join Date: Dec 2011
If you have the option turn off the auto buffer and set it to huge or large. This solved my problem with poweramp. Google music player does not have this issue.

Sent from my Galaxy Nexus using xda premium
 
xHausx
Old
#6  
xHausx's Avatar
Forum Moderator / Recognized Developer
Thanks Meter 3545
Posts: 6,153
Join Date: Jul 2010
Location: Central Florida

 
DONATE TO ME
Moved to General
 
Luxferro
Old
#7  
Senior Member
Thanks Meter 233
Posts: 972
Join Date: Nov 2009
Location: Long Island, NY
Quote:
Originally Posted by xHausx View Post
Moved to General
Um, this guy is developing an app. Doesn't seem like it belongs lost in the general BS of general. He's obviously a dev asking dev advice. Use open eye method of reading
 
Superfrag
Old
#8  
Superfrag's Avatar
Senior Member
Thanks Meter 6
Posts: 325
Join Date: Jul 2010
Location: Erie
Quote:
Originally Posted by @rbiter View Post
If you have the option turn off the auto buffer and set it to huge or large. This solved my problem with poweramp. Google music player does not have this issue.

Sent from my Galaxy Nexus using xda premium
Didn't solve the problem for me.

Will try again with the latest build..
Galaxy Nexus | HTC Sensation | Nexus S | Galaxy Tab 10.1 32GB I/O
My Last.fm Page
My Twitter!
"We all got our choices to make." "Damn Shame."
 
bongadadu
Old
#9  
Member
Thanks Meter 1
Posts: 68
Join Date: Mar 2011
Quote:
Originally Posted by @rbiter View Post
If you have the option turn off the auto buffer and set it to huge or large. This solved my problem with poweramp. Google music player does not have this issue.

Sent from my Galaxy Nexus using xda premium
I have this issue with the goole music app as well, only on certain tracks though...dunno whats goin on
 
sinatosk
Old
#10  
sinatosk's Avatar
Senior Member
Thanks Meter 3
Posts: 154
Join Date: Oct 2009
Quote:
Originally Posted by Superfrag View Post
The same thing is happening to me when I was listening to music the other day, using PowerAMP. Moment the phone goes to sleep, the music starts stuttering. Annoying.
I get this aswell... there is a buffer option in poweramp which I've not tried yet... glad I'm not the only one though
Google Asus Nexus 7 16GB
Google Nexus 4 16GB

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...

XDA PORTAL POSTS

What Happened at Google I/O 2013 – XDA Developer TV

Unless you just emerged from a deep, dark, dank cavern under the Earth, you know … more

Forums Added for the LG Optimus G Pro and Sony Xperia Tablet Z

Not too long ago, we talked about how Sony was continuing its AOSP efforts on … more

Permanent Screen Off for the Visually Impaired

Most of us take the simple act of waking up our devices and having a quick glance at the … more

App Analytics, or the Death of the Independent App Developer

This is entry number one in a series of articles about tools for app developers, … more