Commit 5a72b945 by krocard Committed by Christos Tsilopoulos

Allow offload gapless for Pixel on R

Gapless offload is fixed in later R beta builds of all Pixels supporting R.

On the firsts R beta builds of Pixel 4, run the following command.
`setprop vendor.audio.offload.gapless.enabled true`.

It can not be enabled on the first Pixel 2 and 3 beta build.

PiperOrigin-RevId: 318436134
parent a971d09a
...@@ -1286,12 +1286,19 @@ public final class DefaultAudioSink implements AudioSink { ...@@ -1286,12 +1286,19 @@ public final class DefaultAudioSink implements AudioSink {
audioFormat, audioAttributes.getAudioAttributesV21())) { audioFormat, audioAttributes.getAudioAttributesV21())) {
return false; return false;
} }
if (trimStartFrames > 0 || trimEndFrames > 0) { boolean noGapless = trimStartFrames == 0 && trimEndFrames == 0;
// TODO(internal b/158191844): Gapless offload is not supported by all devices and there is no return noGapless || isOffloadGaplessSupported();
// API to query its support. }
return false;
} /**
return true; * Returns if the device supports gapless in offload playback.
*
* <p>Gapless offload is not supported by all devices and there is no API to query its support. As
* a result this detection is currently based on manual testing. TODO(internal b/158191844): Add
* an SDK API to query offload gapless support.
*/
private static boolean isOffloadGaplessSupported() {
return Util.SDK_INT >= 30 && Util.MODEL.startsWith("Pixel");
} }
private static boolean isOffloadedPlayback(AudioTrack audioTrack) { private static boolean isOffloadedPlayback(AudioTrack audioTrack) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment