androidx / androidx/media

Consider not calling doSomework every second when paused and fully buffered

Open
#2,336 2 comments 0 reactions 1 assignee View on GitHub

@tonihei is already working on this.

Since Apr 17, 2025.

enhancement
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 1.6.0

More version details

No response

Devices that reproduce the issue

All

Devices that do not reproduce the issue

N/A

Reproducible in the demo app?

Yes

Reproduction steps

Play something then pause, doSomeWork keeps being called even if there's no reasons, as unpausing will restart it anyway.

Expected result

Optimize CPU usage and keep doing nothing when there's for sure nothing to do.

I report this as bug report, because IMO it is, but it's probably a feature request to optimize this part.

The main reason is because of Samsung devices that will keep restarting apps that support media resumption.
In my case my app on restart will restore the queue and already preload the media in paused status for faster restart from media session. In some cases I even have 2 players in that state.
I expect those players to no consume any CPU, but they do even if not much it's nearly all day long due to the app being restarted by the OS.

Actual result

doSomeWork is still called regularly.

Media

N/A

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.