Commit 978a4d85 by Oliver Woodman

Handle getting the audio track's position before the first AC-3 buffer.

ac3Bitrate is set only after the first buffer is handled, which meant that
getting the playback position would cause a divide by zero before then.

When playing back AC-3 content, the ac3Bitrate will always be set after the
first buffer is handled, so return a 0 position if it is not set.
parent 5a3340d6
...@@ -641,7 +641,8 @@ public final class AudioTrack { ...@@ -641,7 +641,8 @@ public final class AudioTrack {
private long bytesToFrames(long byteCount) { private long bytesToFrames(long byteCount) {
if (isAc3) { if (isAc3) {
return byteCount * 8 * sampleRate / (1000 * ac3Bitrate); return
ac3Bitrate == UNKNOWN_AC3_BITRATE ? 0L : byteCount * 8 * sampleRate / (1000 * ac3Bitrate);
} else { } else {
return byteCount / frameSize; return byteCount / frameSize;
} }
......
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