FakeMediaPeriod.TrackDataFactory


public interface FakeMediaPeriod.TrackDataFactory


A factory to create the test data for a particular track.

Summary

Public methods

abstract List<FakeSampleStream.FakeSampleStreamItem>
create(Format format, MediaSource.MediaPeriodId mediaPeriodId)

Returns the list of FakeSampleStream.FakeSampleStreamItems that will be written the sample queue during playback.

default static FakeMediaPeriod.TrackDataFactory
samplesWithRateDurationAndKeyframeInterval(
    long initialSampleTimeUs,
    float sampleRate,
    long durationUs,
    int keyFrameInterval
)

Creates a TrackDataFactory which generates samples at the given rate to cover the provided duration, with a specified key frame interval.

default static FakeMediaPeriod.TrackDataFactory
singleSampleWithTimeUs(long sampleTimeUs)

Returns a factory that always provides a single keyframe sample with time=sampleTimeUs and then end-of-stream.

Public methods

create

abstract List<FakeSampleStream.FakeSampleStreamItemcreate(Format format, MediaSource.MediaPeriodId mediaPeriodId)

Returns the list of FakeSampleStream.FakeSampleStreamItems that will be written the sample queue during playback.

Parameters
Format format

The format of the track to provide data for.

MediaSource.MediaPeriodId mediaPeriodId

The MediaPeriodId to provide data for.

samplesWithRateDurationAndKeyframeInterval

default static FakeMediaPeriod.TrackDataFactory samplesWithRateDurationAndKeyframeInterval(
    long initialSampleTimeUs,
    float sampleRate,
    long durationUs,
    int keyFrameInterval
)

Creates a TrackDataFactory which generates samples at the given rate to cover the provided duration, with a specified key frame interval.

Parameters
long initialSampleTimeUs

The time of the initial sample, in microseconds.

float sampleRate

The number of samples per second.

long durationUs

The duration of samples to generate, in microseconds.

int keyFrameInterval

The number of samples between each keyframe (inclusive).

Returns
FakeMediaPeriod.TrackDataFactory

The TrackDataFactory.

singleSampleWithTimeUs

default static FakeMediaPeriod.TrackDataFactory singleSampleWithTimeUs(long sampleTimeUs)

Returns a factory that always provides a single keyframe sample with time=sampleTimeUs and then end-of-stream.