Remove reseeking hack
This commit is contained in:
parent
a8197c93e1
commit
0500654188
|
@ -442,9 +442,6 @@ public class AudioPlayer implements MethodCallHandler {
|
||||||
int decoderIdleCount = 0;
|
int decoderIdleCount = 0;
|
||||||
boolean finishedReading = false;
|
boolean finishedReading = false;
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
// The extractor position seems to jump around at the beginning.
|
|
||||||
// This is a hack to address that.
|
|
||||||
long behindStartTime = 0;
|
|
||||||
byte[] sonicOut = new byte[audioTrackBufferSize];
|
byte[] sonicOut = new byte[audioTrackBufferSize];
|
||||||
try {
|
try {
|
||||||
audioTrack.play();
|
audioTrack.play();
|
||||||
|
@ -460,16 +457,6 @@ public class AudioPlayer implements MethodCallHandler {
|
||||||
ByteBuffer inputBuffer = codec.getInputBuffer(inputBufferIndex);
|
ByteBuffer inputBuffer = codec.getInputBuffer(inputBufferIndex);
|
||||||
long presentationTime = extractor.getSampleTime();
|
long presentationTime = extractor.getSampleTime();
|
||||||
int presentationTimeMs = (int)(presentationTime / 1000);
|
int presentationTimeMs = (int)(presentationTime / 1000);
|
||||||
if (presentationTimeMs < start) {
|
|
||||||
if (behindStartTime == 0) behindStartTime = System.currentTimeMillis();
|
|
||||||
if (System.currentTimeMillis() - behindStartTime > BEHIND_LIMIT) {
|
|
||||||
System.out.println("Too early, re-seeking");
|
|
||||||
extractor.seekTo(start*1000L, MediaExtractor.SEEK_TO_CLOSEST_SYNC);
|
|
||||||
behindStartTime = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
behindStartTime = 0;
|
|
||||||
}
|
|
||||||
int sampleSize = extractor.readSampleData(inputBuffer, 0);
|
int sampleSize = extractor.readSampleData(inputBuffer, 0);
|
||||||
if (firstSample && sampleSize == 2 && format.getString(MediaFormat.KEY_MIME).equals("audio/mp4a-latm")) {
|
if (firstSample && sampleSize == 2 && format.getString(MediaFormat.KEY_MIME).equals("audio/mp4a-latm")) {
|
||||||
// Skip initial frames.
|
// Skip initial frames.
|
||||||
|
|
|
@ -87,7 +87,7 @@ packages:
|
||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "0.0.2"
|
version: "0.0.3"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
Loading…
Reference in New Issue