AudioOffload recovery.

Avoids disabling Offload on a write error, and instead relies on this being disabled on the AudioTrack init. It will no longer recover by disabling offload.

PiperOrigin-RevId: 465248917
This commit is contained in:
yschimke 2022-08-04 08:00:57 +00:00 committed by tonihei
parent 2347db5d74
commit a10af8ecda

View File

@ -1196,10 +1196,12 @@ public final class DefaultAudioSink implements AudioSink {
if (bytesWrittenOrError < 0) {
int error = bytesWrittenOrError;
boolean isRecoverable = isAudioTrackDeadObject(error);
if (isRecoverable) {
maybeDisableOffload();
}
// Treat a write error on a previously successful offload channel as recoverable
// without disabling offload. Offload will be disabled when a new AudioTrack is created,
// if no longer supported.
boolean isRecoverable = isAudioTrackDeadObject(error) && writtenEncodedFrames > 0;
WriteException e = new WriteException(error, configuration.inputFormat, isRecoverable);
if (listener != null) {
listener.onAudioSinkError(e);