Skip to content

Conversation

@madebymozart
Copy link
Collaborator

Summary

This PR addresses an issue where audio streams could become silent or stall when the device display is turned off.

Screenshot_20260128_163525 Screenshot_20260128_164517 Screenshot_20260128_164556

Changes

  • Enhanced State Recovery: Improved the internal logic to detect when the hardware path has been interrupted by power management.
  • Callback Continuity: Adjusted the buffer handling to ensure that callbacks continue to be serviced or correctly restarted if the system silences the stream during the display-off transition.
  • Offload Stability: (If applicable) Fixed a specific stall in the PCM Offload path that occurred when the display-off signal triggered a resource re-evaluation.

Checklist

  • Tested on physical device (Pixel 9 Pro)
  • No regressions in Oboe PCM Offload playback
  • Code follows Oboe coding style guidelines

@madebymozart madebymozart requested a review from flamme January 28, 2026 21:52
@madebymozart madebymozart self-assigned this Jan 28, 2026
}

if (!wakeLock.isHeld) {
wakeLock.acquire(10*60*1000L /*10 minutes*/)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If wake lock is held when doing audio playback, the device won't be able to go into deep suspend, which indicates the offload work may not really save much power.


val powerManager = getSystemService(POWER_SERVICE) as PowerManager
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "PowerPlay::AudioWakeLock")
} catch (e: Throwable) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be more specific which exception may be thrown from which function call?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants