Search in sources :

Example 61 with FakeExtractorOutput

use of com.google.android.exoplayer2.testutil.FakeExtractorOutput in project ExoPlayer by google.

the class WebvttExtractorTest method read_handlesLargeCueTimestamps.

@Test
public void read_handlesLargeCueTimestamps() throws Exception {
    TimestampAdjuster timestampAdjuster = new TimestampAdjuster(/* firstSampleTimestampUs= */
    0);
    // Prime the TimestampAdjuster with a close-ish timestamp (5s before the first cue).
    timestampAdjuster.adjustTsTimestamp(384615190);
    WebvttExtractor extractor = new WebvttExtractor(/* language= */
    null, timestampAdjuster);
    // We can't use ExtractorAsserts because WebvttExtractor doesn't fulfill the whole Extractor
    // interface (e.g. throws an exception from seek()).
    FakeExtractorOutput output = TestUtil.extractAllSamplesFromFile(extractor, ApplicationProvider.getApplicationContext(), "media/webvtt/with_x-timestamp-map_header");
    // The output has a ~5s sampleTime and a large, negative subsampleOffset because the cue
    // timestamps are ~10 days ahead of the PTS (due to wrapping) so the offset is used to ensure
    // they're rendered at the right time.
    DumpFileAsserts.assertOutput(ApplicationProvider.getApplicationContext(), output, "extractordumps/webvtt/with_x-timestamp-map_header.dump");
}
Also used : TimestampAdjuster(com.google.android.exoplayer2.util.TimestampAdjuster) FakeExtractorOutput(com.google.android.exoplayer2.testutil.FakeExtractorOutput) Test(org.junit.Test)

Aggregations

FakeExtractorOutput (com.google.android.exoplayer2.testutil.FakeExtractorOutput)52 Test (org.junit.Test)43 SeekMap (com.google.android.exoplayer2.extractor.SeekMap)35 FakeTrackOutput (com.google.android.exoplayer2.testutil.FakeTrackOutput)32 Uri (android.net.Uri)25 FakeExtractorInput (com.google.android.exoplayer2.testutil.FakeExtractorInput)11 PositionHolder (com.google.android.exoplayer2.extractor.PositionHolder)10 WebvttDecoder (com.google.android.exoplayer2.text.webvtt.WebvttDecoder)6 TimestampAdjuster (com.google.android.exoplayer2.util.TimestampAdjuster)6 Before (org.junit.Before)6 Format (com.google.android.exoplayer2.Format)4 ExtractorInput (com.google.android.exoplayer2.extractor.ExtractorInput)4 DefaultExtractorInput (com.google.android.exoplayer2.extractor.DefaultExtractorInput)3 TrackOutput (com.google.android.exoplayer2.extractor.TrackOutput)2 SimulatedIOException (com.google.android.exoplayer2.testutil.FakeExtractorInput.SimulatedIOException)2 IOException (java.io.IOException)2 TrackIdGenerator (com.google.android.exoplayer2.extractor.ts.TsPayloadReader.TrackIdGenerator)1 ParsableByteArray (com.google.android.exoplayer2.util.ParsableByteArray)1