Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isOffloaded method to query AudioTrack offload state. #134

Open
yschimke opened this issue Jul 30, 2022 · 3 comments
Open

Add isOffloaded method to query AudioTrack offload state. #134

yschimke opened this issue Jul 30, 2022 · 3 comments
Assignees

Comments

@yschimke
Copy link
Contributor

yschimke commented Jul 30, 2022

Use case description

The current interface doesn't provide actual status of offload (whether is enabled on the AudioTrack, not whether it's sleeping). It doesn't allow apps making decisions to keep using offload support after a write error, which may be transient.

Requests:

  • call a new method AudioOffloadListener.isOffloadedPlayback with the value of AudioTrack.isOffloadedPlayback. This may be true, even when sleepingForOffload is false.
  • Allow AudioOffloadListener to be involved in the DefaultAudioSink maybeDisableOffload decision, such as trying additional times with offload enabled.
  • Expose the reason for offload being disabled, such as Audio Init errors, or write errors, or not supported for format.

Proposed solution

Add additional methods to AudioOffloadListener that affect the

Alternatives considered

Expose AudioTrack and additional logging.

@yschimke
Copy link
Contributor Author

yschimke commented Aug 1, 2022

Potentially also, allow an offload only mode DefaultSudioSink.OFFLOAD_MODE_ENABLED_ONLY ?

Similar to #133, there are cases where offload can get disabled (a write error) or other app takes over (TBC?) and we end up playing in SW mode and no way to revert back to offload enabled, until we reconfigure.

@yschimke
Copy link
Contributor Author

yschimke commented Aug 1, 2022

I think we agreed I'd put up a speculative CL with just

call a new method AudioOffloadListener.isOffloadedPlayback with the value of AudioTrack.isOffloadedPlayback. This may be true, even when sleepingForOffload is false.

and another one that avoids the disabling retry on a write error.

Speculative as in, no issue if we decide not to proceed.

@tonihei
Copy link
Collaborator

tonihei commented Aug 2, 2022

Offload integration is still experimental for now and doesn't expose all the configuration needed.

  • The final state will likely have a getter similar to `isOffloadedPlayback. I'll keep this enhancement open to track this.
  • Error recovery could be made configurable, but it's less important and also not currently done for decoder fallback and similar logic elsewhere. (We only have configurable error handling on the loading side at the moment).

@tonihei tonihei changed the title Expand AudioOffloadListener functionality Add isOffloaded method to query AudioTrack offload state. Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants