Search in sources :

Example 11 with DecoderReuseEvaluation

use of com.google.android.exoplayer2.decoder.DecoderReuseEvaluation in project ExoPlayer by google.

the class MediaCodecInfoTest method canKeepCodec_colorInfoOmittedFromOldFormat_returnsNo.

@Test
public void canKeepCodec_colorInfoOmittedFromOldFormat_returnsNo() {
    MediaCodecInfo codecInfo = buildH264CodecInfo(/* adaptive= */
    false);
    Format hdrVariantFormat = FORMAT_H264_4K.buildUpon().setColorInfo(buildColorInfo(C.COLOR_SPACE_BT601)).build();
    assertThat(codecInfo.canReuseCodec(FORMAT_H264_4K, hdrVariantFormat)).isEqualTo(new DecoderReuseEvaluation(codecInfo.name, FORMAT_H264_4K, hdrVariantFormat, REUSE_RESULT_NO, DISCARD_REASON_VIDEO_COLOR_INFO_CHANGED));
}
Also used : Format(com.google.android.exoplayer2.Format) DecoderReuseEvaluation(com.google.android.exoplayer2.decoder.DecoderReuseEvaluation) Test(org.junit.Test)

Example 12 with DecoderReuseEvaluation

use of com.google.android.exoplayer2.decoder.DecoderReuseEvaluation in project ExoPlayer by google.

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(com.google.android.exoplayer2.Format) DecoderReuseEvaluation(com.google.android.exoplayer2.decoder.DecoderReuseEvaluation) Test(org.junit.Test)

Example 13 with DecoderReuseEvaluation

use of com.google.android.exoplayer2.decoder.DecoderReuseEvaluation in project ExoPlayer by google.

the class MediaCodecInfoTest method canKeepCodec_colorInfoChange_returnsNo.

@Test
public void canKeepCodec_colorInfoChange_returnsNo() {
    MediaCodecInfo codecInfo = buildH264CodecInfo(/* adaptive= */
    false);
    Format hdrVariantFormat1 = FORMAT_H264_4K.buildUpon().setColorInfo(buildColorInfo(C.COLOR_SPACE_BT601)).build();
    Format hdrVariantFormat2 = FORMAT_H264_4K.buildUpon().setColorInfo(buildColorInfo(C.COLOR_SPACE_BT709)).build();
    assertThat(codecInfo.canReuseCodec(hdrVariantFormat1, hdrVariantFormat2)).isEqualTo(new DecoderReuseEvaluation(codecInfo.name, hdrVariantFormat1, hdrVariantFormat2, REUSE_RESULT_NO, DISCARD_REASON_VIDEO_COLOR_INFO_CHANGED));
}
Also used : Format(com.google.android.exoplayer2.Format) DecoderReuseEvaluation(com.google.android.exoplayer2.decoder.DecoderReuseEvaluation) Test(org.junit.Test)

Example 14 with DecoderReuseEvaluation

use of com.google.android.exoplayer2.decoder.DecoderReuseEvaluation in project ExoPlayer by google.

the class MediaCodecInfoTest method canKeepCodec_colorInfoOmittedFromNewFormat_returnsNo.

@Test
public void canKeepCodec_colorInfoOmittedFromNewFormat_returnsNo() {
    MediaCodecInfo codecInfo = buildH264CodecInfo(/* adaptive= */
    false);
    Format hdrVariantFormat = FORMAT_H264_4K.buildUpon().setColorInfo(buildColorInfo(C.COLOR_SPACE_BT601)).build();
    assertThat(codecInfo.canReuseCodec(hdrVariantFormat, FORMAT_H264_4K)).isEqualTo(new DecoderReuseEvaluation(codecInfo.name, hdrVariantFormat, FORMAT_H264_4K, REUSE_RESULT_NO, DISCARD_REASON_VIDEO_COLOR_INFO_CHANGED));
}
Also used : Format(com.google.android.exoplayer2.Format) DecoderReuseEvaluation(com.google.android.exoplayer2.decoder.DecoderReuseEvaluation) Test(org.junit.Test)

Example 15 with DecoderReuseEvaluation

use of com.google.android.exoplayer2.decoder.DecoderReuseEvaluation in project ExoPlayer by google.

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(com.google.android.exoplayer2.Format) DecoderReuseEvaluation(com.google.android.exoplayer2.decoder.DecoderReuseEvaluation) Test(org.junit.Test)

Aggregations

DecoderReuseEvaluation (com.google.android.exoplayer2.decoder.DecoderReuseEvaluation)19 Format (com.google.android.exoplayer2.Format)11 Test (org.junit.Test)11 Nullable (androidx.annotation.Nullable)4 DecoderDiscardReasons (com.google.android.exoplayer2.decoder.DecoderReuseEvaluation.DecoderDiscardReasons)4 SuppressLint (android.annotation.SuppressLint)2 Point (android.graphics.Point)2 CallSuper (androidx.annotation.CallSuper)2 EventTime (com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)2 MediaFormat (android.media.MediaFormat)1