Commit 0dfc1d3b by Oliver Woodman

Don't sample the timestamp/latency for AC-3 passthrough playback.

parent 9f53ea81
...@@ -574,6 +574,7 @@ public final class AudioTrack { ...@@ -574,6 +574,7 @@ public final class AudioTrack {
submittedBytes = 0; submittedBytes = 0;
temporaryBufferSize = 0; temporaryBufferSize = 0;
startMediaTimeUs = START_NOT_SET; startMediaTimeUs = START_NOT_SET;
latencyUs = 0;
resetSyncParams(); resetSyncParams();
int playState = audioTrack.getPlayState(); int playState = audioTrack.getPlayState();
if (playState == android.media.AudioTrack.PLAYSTATE_PLAYING) { if (playState == android.media.AudioTrack.PLAYSTATE_PLAYING) {
...@@ -647,9 +648,10 @@ public final class AudioTrack { ...@@ -647,9 +648,10 @@ public final class AudioTrack {
} }
} }
if (systemClockUs - lastTimestampSampleTimeUs >= MIN_TIMESTAMP_SAMPLE_INTERVAL_US) { // Don't sample the timestamp and latency if this is an AC-3 passthrough AudioTrack, as the
// Don't use AudioTrack.getTimestamp() on AC-3 tracks, as it gives an incorrect timestamp. // returned values cause audio/video synchronization to be incorrect.
audioTimestampSet = !isAc3 && audioTrackUtil.updateTimestamp(); if (!isAc3 && systemClockUs - lastTimestampSampleTimeUs >= MIN_TIMESTAMP_SAMPLE_INTERVAL_US) {
audioTimestampSet = audioTrackUtil.updateTimestamp();
if (audioTimestampSet) { if (audioTimestampSet) {
// Perform sanity checks on the timestamp. // Perform sanity checks on the timestamp.
long audioTimestampUs = audioTrackUtil.getTimestampNanoTime() / 1000; long audioTimestampUs = audioTrackUtil.getTimestampNanoTime() / 1000;
......
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