Skip to content

Add isOffloaded method to query AudioTrack offload state. #134

Open

Description

@yschimke

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.

Activity

  1. yschimke commented on Aug 1, 2022

    @yschimke
    ContributorAuthor

    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.

  2. yschimke commented on Aug 1, 2022

    @yschimke
    ContributorAuthor

    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.

  3. tonihei commented on Aug 2, 2022

    @tonihei
    Collaborator

    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).
  4. changed the title [-]Expand AudioOffloadListener functionality[/-] [+]Add isOffloaded method to query AudioTrack offload state.[/+] on Aug 2, 2022
  5. added a commit that references this issue on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions