Search in sources :

Example 11 with DecoderReuseEvaluation

use of androidx.media3.exoplayer.DecoderReuseEvaluation in project media by androidx.

the class MediaCodecInfoTest method canKeepCodec_withDifferentMimeType_returnsNo.

@Test
public void canKeepCodec_withDifferentMimeType_returnsNo() {
    MediaCodecInfo codecInfo = buildH264CodecInfo(/* adaptive= */
    true);
    Format hdAv1Format = FORMAT_H264_HD.buildUpon().setSampleMimeType(VIDEO_AV1).build();
    assertThat(codecInfo.canReuseCodec(FORMAT_H264_HD, hdAv1Format)).isEqualTo(new DecoderReuseEvaluation(codecInfo.name, FORMAT_H264_HD, hdAv1Format, REUSE_RESULT_NO, DISCARD_REASON_MIME_TYPE_CHANGED));
}
Also used : Format(androidx.media3.common.Format) DecoderReuseEvaluation(androidx.media3.exoplayer.DecoderReuseEvaluation) Test(org.junit.Test)

Example 12 with DecoderReuseEvaluation

use of androidx.media3.exoplayer.DecoderReuseEvaluation in project media by androidx.

the class MediaCodecInfoTest method canKeepCodec_audioWithSameChannelCounts_returnsYesWithFlush.

@Test
public void canKeepCodec_audioWithSameChannelCounts_returnsYesWithFlush() {
    MediaCodecInfo codecInfo = buildAacCodecInfo();
    Format stereoVariantFormat = FORMAT_AAC_STEREO.buildUpon().setAverageBitrate(100).build();
    assertThat(codecInfo.canReuseCodec(FORMAT_AAC_STEREO, stereoVariantFormat)).isEqualTo(new DecoderReuseEvaluation(codecInfo.name, FORMAT_AAC_STEREO, stereoVariantFormat, REUSE_RESULT_YES_WITH_FLUSH, /* discardReasons= */
    0));
}
Also used : Format(androidx.media3.common.Format) DecoderReuseEvaluation(androidx.media3.exoplayer.DecoderReuseEvaluation) Test(org.junit.Test)

Example 13 with DecoderReuseEvaluation

use of androidx.media3.exoplayer.DecoderReuseEvaluation in project media by androidx.

the class MediaCodecInfoTest method canKeepCodec_audioWithDifferentChannelCounts_returnsNo.

@Test
public void canKeepCodec_audioWithDifferentChannelCounts_returnsNo() {
    MediaCodecInfo codecInfo = buildAacCodecInfo();
    assertThat(codecInfo.canReuseCodec(FORMAT_AAC_STEREO, FORMAT_AAC_SURROUND)).isEqualTo(new DecoderReuseEvaluation(codecInfo.name, FORMAT_AAC_STEREO, FORMAT_AAC_SURROUND, REUSE_RESULT_NO, DISCARD_REASON_AUDIO_CHANNEL_COUNT_CHANGED));
}
Also used : DecoderReuseEvaluation(androidx.media3.exoplayer.DecoderReuseEvaluation) Test(org.junit.Test)

Example 14 with DecoderReuseEvaluation

use of androidx.media3.exoplayer.DecoderReuseEvaluation in project media by androidx.

the class MediaCodecInfoTest method canKeepCodec_audioWithDifferentInitializationData_returnsNo.

@Test
public void canKeepCodec_audioWithDifferentInitializationData_returnsNo() {
    MediaCodecInfo codecInfo = buildAacCodecInfo();
    Format stereoVariantFormat = FORMAT_AAC_STEREO.buildUpon().setInitializationData(ImmutableList.of(new byte[] { 0 })).build();
    assertThat(codecInfo.canReuseCodec(FORMAT_AAC_STEREO, stereoVariantFormat)).isEqualTo(new DecoderReuseEvaluation(codecInfo.name, FORMAT_AAC_STEREO, stereoVariantFormat, REUSE_RESULT_NO, DISCARD_REASON_INITIALIZATION_DATA_CHANGED));
}
Also used : Format(androidx.media3.common.Format) DecoderReuseEvaluation(androidx.media3.exoplayer.DecoderReuseEvaluation) Test(org.junit.Test)

Example 15 with DecoderReuseEvaluation

use of androidx.media3.exoplayer.DecoderReuseEvaluation in project media by androidx.

the class MediaCodecInfoTest method canKeepCodec_noResolutionChange_nonAdaptiveCodec_returnsYesWithReconfiguration.

@Test
public void canKeepCodec_noResolutionChange_nonAdaptiveCodec_returnsYesWithReconfiguration() {
    MediaCodecInfo codecInfo = buildH264CodecInfo(/* adaptive= */
    false);
    Format hdVariantFormat = FORMAT_H264_HD.buildUpon().setInitializationData(ImmutableList.of(new byte[] { 0 })).build();
    assertThat(codecInfo.canReuseCodec(FORMAT_H264_HD, hdVariantFormat)).isEqualTo(new DecoderReuseEvaluation(codecInfo.name, FORMAT_H264_HD, hdVariantFormat, REUSE_RESULT_YES_WITH_RECONFIGURATION, /* discardReasons= */
    0));
}
Also used : Format(androidx.media3.common.Format) DecoderReuseEvaluation(androidx.media3.exoplayer.DecoderReuseEvaluation) Test(org.junit.Test)

Aggregations

DecoderReuseEvaluation (androidx.media3.exoplayer.DecoderReuseEvaluation)19 Format (androidx.media3.common.Format)11 Test (org.junit.Test)11 Nullable (androidx.annotation.Nullable)4 DecoderDiscardReasons (androidx.media3.exoplayer.DecoderReuseEvaluation.DecoderDiscardReasons)4 SuppressLint (android.annotation.SuppressLint)2 Point (android.graphics.Point)2 CallSuper (androidx.annotation.CallSuper)2 EventTime (androidx.media3.exoplayer.analytics.AnalyticsListener.EventTime)2 MediaFormat (android.media.MediaFormat)1