Disable gapless support for offload when pre-API 33

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
This commit is contained in:
michaelkatz 2023-06-22 09:56:37 +00:00 committed by Tofunmi Adigun-Hameed
parent be38670391
commit ca22fe7c74
2 changed files with 8 additions and 4 deletions

View File

@ -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`.

View File

@ -149,8 +149,6 @@ public final class DefaultAudioOffloadSupportProvider
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();
}
}
@ -170,10 +168,14 @@ public final class DefaultAudioOffloadSupportProvider
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();
}