开发者

Android:Question about cpu usage.

开发者 https://www.devze.com 2023-03-23 19:41 出处:网络
I\'m currently developing a music player and created a service in order to play the music in the background. In the task manager of my Galaxy S I noticed that the CPU-usage of my app goes from 0,30-1,

I'm currently developing a music player and created a service in order to play the music in the background. In the task manager of my Galaxy S I noticed that the CPU-usage of my app goes from 0,30-1,10%, and I also noticed that the CPU-usage of the native music player (and others too) is around 0,00%(stable). What's could be the cause of the increased usage%?

Note: I'm not using any multit开发者_如何学Chreading or asynctasks in my app.


This can happen in case you are using custom multimedia stack instead of default android stack. i.e. if you are not using MediaPlayer class. MediaPlayer class internally interacts with the appropriate media frameworks say Stagefright or Opencore. These media frameworks will have hardware accelerated decoders => low CPU consumption.

However if you are using AudioTrack, then parsing and decoding is on you and it is decoding that will take considerable amount of time. That definitely can result in increase in CPU usage.

Shash

0

精彩评论

暂无评论...
验证码 换一张
取 消