use of com.google.android.exoplayer2.testutil.FakeExtractorOutput in project ExoPlayer by google.
the class SubtitleExtractorTest method seek_afterRelease_fails.
@Test
public void seek_afterRelease_fails() {
SubtitleExtractor extractor = new SubtitleExtractor(new WebvttDecoder(), new Format.Builder().build());
FakeExtractorOutput output = new FakeExtractorOutput();
extractor.init(output);
extractor.release();
assertThrows(IllegalStateException.class, () -> extractor.seek(0, 0));
}
use of com.google.android.exoplayer2.testutil.FakeExtractorOutput in project ExoPlayer by google.
the class SubtitleExtractorTest method released_calledTwice.
@Test
public void released_calledTwice() {
SubtitleExtractor extractor = new SubtitleExtractor(new WebvttDecoder(), new Format.Builder().build());
FakeExtractorOutput output = new FakeExtractorOutput();
extractor.init(output);
extractor.release();
extractor.release();
// Calling realease() twice does not throw an exception.
}
use of com.google.android.exoplayer2.testutil.FakeExtractorOutput in project ExoPlayer by google.
the class AdtsReaderTest method setUp.
@Before
public void setUp() throws Exception {
FakeExtractorOutput fakeExtractorOutput = new FakeExtractorOutput();
adtsOutput = fakeExtractorOutput.track(0, C.TRACK_TYPE_AUDIO);
id3Output = fakeExtractorOutput.track(1, C.TRACK_TYPE_METADATA);
adtsReader = new AdtsReader(true);
TrackIdGenerator idGenerator = new TrackIdGenerator(0, 1);
adtsReader.createTracks(fakeExtractorOutput, idGenerator);
data = new ParsableByteArray(TEST_DATA);
firstFeed = true;
}
use of com.google.android.exoplayer2.testutil.FakeExtractorOutput in project ExoPlayer by google.
the class IndexSeekerTest method mp3ExtractorReads_correctsInexactDuration.
@Test
public void mp3ExtractorReads_correctsInexactDuration() throws Exception {
FakeExtractorOutput extractorOutput = TestUtil.extractAllSamplesFromFile(extractor, ApplicationProvider.getApplicationContext(), TEST_FILE_NO_SEEK_TABLE);
SeekMap seekMap = extractorOutput.seekMap;
assertThat(seekMap.getDurationUs()).isEqualTo(TEST_FILE_NO_SEEK_TABLE_DURATION);
}
use of com.google.android.exoplayer2.testutil.FakeExtractorOutput in project ExoPlayer by google.
the class TsExtractorTest method customPesReader.
@Test
public void customPesReader() throws Exception {
CustomTsPayloadReaderFactory factory = new CustomTsPayloadReaderFactory(true, false);
TsExtractor tsExtractor = new TsExtractor(TsExtractor.MODE_MULTI_PMT, new TimestampAdjuster(0), factory);
FakeExtractorInput input = new FakeExtractorInput.Builder().setData(TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), "media/ts/sample_h262_mpeg_audio.ts")).setSimulateIOErrors(false).setSimulateUnknownLength(false).setSimulatePartialReads(false).build();
FakeExtractorOutput output = new FakeExtractorOutput();
tsExtractor.init(output);
PositionHolder seekPositionHolder = new PositionHolder();
int readResult = Extractor.RESULT_CONTINUE;
while (readResult != Extractor.RESULT_END_OF_INPUT) {
readResult = tsExtractor.read(input, seekPositionHolder);
if (readResult == Extractor.RESULT_SEEK) {
input.setPosition((int) seekPositionHolder.position);
}
}
CustomEsReader reader = factory.esReader;
assertThat(reader.packetsRead).isEqualTo(2);
TrackOutput trackOutput = reader.getTrackOutput();
assertThat(trackOutput == output.trackOutputs.get(257)).isTrue();
assertThat(((FakeTrackOutput) trackOutput).lastFormat).isEqualTo(new Format.Builder().setId("1/257").setSampleMimeType("mime").setLanguage("und").build());
}
Aggregations