Skip to content

Commit

Permalink
AudioOffload recovery.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yschimke authored and marcbaechinger committed Oct 19, 2022
1 parent 30fab8c commit 2fbe1bb
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1187,10 +1187,12 @@ private void writeBuffer(ByteBuffer buffer, long avSyncPresentationTimeUs) throw

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);
Expand Down

0 comments on commit 2fbe1bb

Please sign in to comment.