com.google.android.exoplayer.testutil.FakeTrackOutput

Here are the examples of the java api class com.google.android.exoplayer.testutil.FakeTrackOutput taken from open source projects.

1. Mp4ExtractorTest#testParsesValidMp4FileWithoutStss()

Project: ExoPlayer
Source File: Mp4ExtractorTest.java
View license
public void testParsesValidMp4FileWithoutStss() throws Exception {
    TestUtil.consumeTestData(extractor, getTestInputData(false, /* includeStss */
    false));
    // The seek map is correct.
    assertSeekMap(extractorOutput.seekMap, false);
    // The timestamps and sizes are set correctly, and all samples are synchronization samples.
    FakeTrackOutput videoTrackOutput = extractorOutput.trackOutputs.get(0);
    videoTrackOutput.assertSampleCount(SAMPLE_TIMESTAMPS.length);
    for (int i = 0; i < SAMPLE_TIMESTAMPS.length; i++) {
        byte[] sampleData = getOutputSampleData(i, true);
        int sampleFlags = C.SAMPLE_FLAG_SYNC;
        long sampleTimestampUs = getVideoTimestampUs(SAMPLE_TIMESTAMPS[i]);
        videoTrackOutput.assertSample(i, sampleData, sampleTimestampUs, sampleFlags, null);
    }
}

2. Mp4ExtractorTest#testParsesValidMp4File()

Project: ExoPlayer
Source File: Mp4ExtractorTest.java
View license
public void testParsesValidMp4File() throws Exception {
    TestUtil.consumeTestData(extractor, getTestInputData(true, /* includeStss */
    false));
    // The seek map is correct.
    assertSeekMap(extractorOutput.seekMap, true);
    // The video and audio formats are set correctly.
    assertEquals(2, extractorOutput.trackOutputs.size());
    MediaFormat videoFormat = extractorOutput.trackOutputs.get(0).format;
    MediaFormat audioFormat = extractorOutput.trackOutputs.get(1).format;
    assertEquals(MimeTypes.VIDEO_H264, videoFormat.mimeType);
    assertEquals(VIDEO_WIDTH, videoFormat.width);
    assertEquals(VIDEO_HEIGHT, videoFormat.height);
    assertEquals(MimeTypes.AUDIO_AAC, audioFormat.mimeType);
    // The timestamps and sizes are set correctly.
    FakeTrackOutput videoTrackOutput = extractorOutput.trackOutputs.get(0);
    videoTrackOutput.assertSampleCount(SAMPLE_TIMESTAMPS.length);
    for (int i = 0; i < SAMPLE_TIMESTAMPS.length; i++) {
        byte[] sampleData = getOutputSampleData(i, true);
        int sampleFlags = SAMPLE_IS_SYNC[i] ? C.SAMPLE_FLAG_SYNC : 0;
        long sampleTimestampUs = getVideoTimestampUs(SAMPLE_TIMESTAMPS[i]);
        videoTrackOutput.assertSample(i, sampleData, sampleTimestampUs, sampleFlags, null);
    }
}

3. Mp4ExtractorTest#testParsesValidMp4vFile()

Project: ExoPlayer
Source File: Mp4ExtractorTest.java
View license
public void testParsesValidMp4vFile() throws Exception {
    TestUtil.consumeTestData(extractor, getTestInputData(true, /* includeStss */
    true));
    // The seek map is correct.
    assertSeekMap(extractorOutput.seekMap, true);
    // The video and audio formats are set correctly.
    assertEquals(2, extractorOutput.trackOutputs.size());
    MediaFormat videoFormat = extractorOutput.trackOutputs.get(0).format;
    MediaFormat audioFormat = extractorOutput.trackOutputs.get(1).format;
    assertEquals(MimeTypes.VIDEO_MP4V, videoFormat.mimeType);
    assertEquals(VIDEO_MP4V_WIDTH, videoFormat.width);
    assertEquals(VIDEO_MP4V_HEIGHT, videoFormat.height);
    assertEquals(MimeTypes.AUDIO_AAC, audioFormat.mimeType);
    // The timestamps and sizes are set correctly.
    FakeTrackOutput videoTrackOutput = extractorOutput.trackOutputs.get(0);
    videoTrackOutput.assertSampleCount(SAMPLE_TIMESTAMPS.length);
    for (int i = 0; i < SAMPLE_TIMESTAMPS.length; i++) {
        byte[] sampleData = getOutputSampleData(i, false);
        int sampleFlags = SAMPLE_IS_SYNC[i] ? C.SAMPLE_FLAG_SYNC : 0;
        long sampleTimestampUs = getVideoTimestampUs(SAMPLE_TIMESTAMPS[i]);
        videoTrackOutput.assertSample(i, sampleData, sampleTimestampUs, sampleFlags, null);
    }
}

4. AdtsReaderTest#setUp()

Project: ExoPlayer
Source File: AdtsReaderTest.java
View license
@Override
protected void setUp() throws Exception {
    adtsOutput = new FakeTrackOutput();
    id3Output = new FakeTrackOutput();
    adtsReader = new AdtsReader(adtsOutput, id3Output);
    data = new ParsableByteArray(TEST_DATA);
    firstFeed = true;
}