From 81417e10934bba510bc4f947eca0e8a3357ef6a2 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Thu, 8 Mar 2018 05:54:44 -0800 Subject: [PATCH] Fix workaround for stale passthrough AudioTrack position When creating a new AC-3 passthrough AudioTrack the position may advance from an old AudioTrack's position. The workaround checked for the playback head position returning to zero, but a subsequent change meant that we'd always start writing data to the new track immediately (rather than waiting for its position to 'stabilize' at zero). Fix the issue by using the AudioTrack position directly. (Nb. this doesn't handle the case of the stale position before unwrapping being zero, but it is very unlikely to occur.) ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=188319795 --- .../com/google/android/exoplayer2/audio/DefaultAudioSink.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java index 6d12dc66e8..ee0fd94ffa 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java @@ -590,7 +590,7 @@ public final class DefaultAudioSink implements AudioSink { // position for a short time after is has been released. Avoid writing data until the playback // head position actually returns to zero. if (audioTrack.getPlayState() == PLAYSTATE_STOPPED - && audioTrackUtil.getPlaybackHeadPosition() != 0) { + && audioTrack.getPlaybackHeadPosition() != 0) { return false; } }