FakeMediaPeriod.TrackDataFactory


interface FakeMediaPeriod.TrackDataFactory


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

Summary

Public functions

(Mutable)List<FakeSampleStream.FakeSampleStreamItem!>!
create(format: Format!, mediaPeriodId: MediaSource.MediaPeriodId!)

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

java-static FakeMediaPeriod.TrackDataFactory!
samplesWithRateDurationAndKeyframeInterval(
    initialSampleTimeUs: Long,
    sampleRate: Float,
    durationUs: Long,
    keyFrameInterval: Int
)

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

java-static FakeMediaPeriod.TrackDataFactory!

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

Public functions

create

fun create(format: Format!, mediaPeriodId: MediaSource.MediaPeriodId!): (Mutable)List<FakeSampleStream.FakeSampleStreamItem!>!

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.

mediaPeriodId: MediaSource.MediaPeriodId!

The MediaPeriodId to provide data for.

samplesWithRateDurationAndKeyframeInterval

java-static fun samplesWithRateDurationAndKeyframeInterval(
    initialSampleTimeUs: Long,
    sampleRate: Float,
    durationUs: Long,
    keyFrameInterval: Int
): FakeMediaPeriod.TrackDataFactory!

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

Parameters
initialSampleTimeUs: Long

The time of the initial sample, in microseconds.

sampleRate: Float

The number of samples per second.

durationUs: Long

The duration of samples to generate, in microseconds.

keyFrameInterval: Int

The number of samples between each keyframe (inclusive).

Returns
FakeMediaPeriod.TrackDataFactory!

The TrackDataFactory.

singleSampleWithTimeUs

java-static fun singleSampleWithTimeUs(sampleTimeUs: Long): FakeMediaPeriod.TrackDataFactory!

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