Skip to content

Commit

Permalink
Disable gapless support for offload when pre-API 33
Browse files Browse the repository at this point in the history
Devices pre-API 33 are not able to comprehend the position reset that occurs by the HAL in offloaded gapless track transitions.

PiperOrigin-RevId: 542503662
  • Loading branch information
microkatz authored and tof-tof committed Jun 22, 2023
1 parent be38670 commit ca22fe7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
`DefaultTrackSelector` will only select an audio track and only if that
track's format is supported in offload. If no audio track is supported
in offload, then no track will be selected.
* Disabling gapless support for offload when pre-API level 33 due to
playback position issue after track transition.
* Remove parameter `enableOffload` from
`DefaultRenderersFactory.buildAudioSink` method signature.
* Remove method `DefaultAudioSink.Builder.setOffloadMode`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ public static AudioOffloadSupport getOffloadedPlaybackSupport(
return new AudioOffloadSupport.Builder()
.setIsFormatSupported(true)
.setIsSpeedChangeSupported(isOffloadVariableRateSupported)
// Manual testing has shown that Pixels on Android 11 support gapless offload.
.setIsGaplessSupported(Util.SDK_INT == 30 && Util.MODEL.startsWith("Pixel"))
.build();
}
}
Expand All @@ -170,10 +168,14 @@ public static AudioOffloadSupport getOffloadedPlaybackSupport(
return AudioOffloadSupport.DEFAULT_UNSUPPORTED;
}
AudioOffloadSupport.Builder audioOffloadSupport = new AudioOffloadSupport.Builder();
// (b/191950723) Gapless is not supported pre-API 33 due to playback position
// issue upon transition of gapless tracks
boolean isGaplessSupported =
Util.SDK_INT > 32
&& playbackOffloadSupport == AudioManager.PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED;
return audioOffloadSupport
.setIsFormatSupported(true)
.setIsGaplessSupported(
playbackOffloadSupport == AudioManager.PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED)
.setIsGaplessSupported(isGaplessSupported)
.setIsSpeedChangeSupported(isOffloadVariableRateSupported)
.build();
}
Expand Down

0 comments on commit ca22fe7

Please sign in to comment.