Merge "Update ExoPlayer version" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3f3b615706
@@ -51,6 +51,7 @@ import com.google.android.exoplayer2.extractor.ts.DefaultTsPayloadReaderFactory;
|
||||
import com.google.android.exoplayer2.extractor.ts.PsExtractor;
|
||||
import com.google.android.exoplayer2.extractor.ts.TsExtractor;
|
||||
import com.google.android.exoplayer2.extractor.wav.WavExtractor;
|
||||
import com.google.android.exoplayer2.upstream.DataReader;
|
||||
import com.google.android.exoplayer2.upstream.DataSource;
|
||||
import com.google.android.exoplayer2.upstream.DataSpec;
|
||||
import com.google.android.exoplayer2.upstream.TransferListener;
|
||||
@@ -60,7 +61,6 @@ import com.google.android.exoplayer2.video.ColorInfo;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -848,7 +848,7 @@ public final class MediaParser {
|
||||
private final String[] mParserNamesPool;
|
||||
private final PositionHolder mPositionHolder;
|
||||
private final InputReadingDataSource mDataSource;
|
||||
private final ExtractorInputAdapter mScratchExtractorInputAdapter;
|
||||
private final DataReaderAdapter mScratchDataReaderAdapter;
|
||||
private final ParsableByteArrayAdapter mScratchParsableByteArrayAdapter;
|
||||
private String mExtractorName;
|
||||
private Extractor mExtractor;
|
||||
@@ -973,10 +973,6 @@ public final class MediaParser {
|
||||
}
|
||||
} catch (EOFException e) {
|
||||
// Do nothing.
|
||||
} catch (InterruptedException e) {
|
||||
// TODO: Remove this exception replacement once we update the ExoPlayer
|
||||
// version.
|
||||
throw new InterruptedIOException();
|
||||
} finally {
|
||||
mExtractorInput.resetPeekPosition();
|
||||
}
|
||||
@@ -999,9 +995,6 @@ public final class MediaParser {
|
||||
result = mExtractor.read(mExtractorInput, mPositionHolder);
|
||||
} catch (ParserException e) {
|
||||
throw new ParsingException(e);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO: Remove this exception replacement once we update the ExoPlayer version.
|
||||
throw new InterruptedIOException();
|
||||
}
|
||||
if (result == Extractor.RESULT_END_OF_INPUT) {
|
||||
return false;
|
||||
@@ -1055,7 +1048,7 @@ public final class MediaParser {
|
||||
mPositionHolder = new PositionHolder();
|
||||
mDataSource = new InputReadingDataSource();
|
||||
removePendingSeek();
|
||||
mScratchExtractorInputAdapter = new ExtractorInputAdapter();
|
||||
mScratchDataReaderAdapter = new DataReaderAdapter();
|
||||
mScratchParsableByteArrayAdapter = new ParsableByteArrayAdapter();
|
||||
}
|
||||
|
||||
@@ -1270,12 +1263,12 @@ public final class MediaParser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sampleData(ExtractorInput input, int length, boolean allowEndOfInput)
|
||||
public int sampleData(DataReader input, int length, boolean allowEndOfInput)
|
||||
throws IOException {
|
||||
mScratchExtractorInputAdapter.setExtractorInput(input, length);
|
||||
long positionBeforeReading = mScratchExtractorInputAdapter.getPosition();
|
||||
mOutputConsumer.onSampleDataFound(mTrackIndex, mScratchExtractorInputAdapter);
|
||||
return (int) (mScratchExtractorInputAdapter.getPosition() - positionBeforeReading);
|
||||
mScratchDataReaderAdapter.setDataReader(input, length);
|
||||
long positionBeforeReading = mScratchDataReaderAdapter.getPosition();
|
||||
mOutputConsumer.onSampleDataFound(mTrackIndex, mScratchDataReaderAdapter);
|
||||
return (int) (mScratchDataReaderAdapter.getPosition() - positionBeforeReading);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1297,14 +1290,14 @@ public final class MediaParser {
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ExtractorInputAdapter implements InputReader {
|
||||
private static final class DataReaderAdapter implements InputReader {
|
||||
|
||||
private ExtractorInput mExtractorInput;
|
||||
private DataReader mDataReader;
|
||||
private int mCurrentPosition;
|
||||
private long mLength;
|
||||
|
||||
public void setExtractorInput(ExtractorInput extractorInput, long length) {
|
||||
mExtractorInput = extractorInput;
|
||||
public void setDataReader(DataReader dataReader, long length) {
|
||||
mDataReader = dataReader;
|
||||
mCurrentPosition = 0;
|
||||
mLength = length;
|
||||
}
|
||||
@@ -1314,12 +1307,7 @@ public final class MediaParser {
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws IOException {
|
||||
int readBytes = 0;
|
||||
try {
|
||||
readBytes = mExtractorInput.read(buffer, offset, readLength);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO: Remove this exception replacement once we update the ExoPlayer version.
|
||||
throw new InterruptedIOException();
|
||||
}
|
||||
readBytes = mDataReader.read(buffer, offset, readLength);
|
||||
mCurrentPosition += readBytes;
|
||||
return readBytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user