Search in sources :

Example 6 with DecoderReuseEvaluation

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

the class MediaCodecInfoTest method canKeepCodec_withResolutionChange_adaptiveCodec_returnsYesWithReconfiguration.

@Test
public void canKeepCodec_withResolutionChange_adaptiveCodec_returnsYesWithReconfiguration() {
    MediaCodecInfo codecInfo = buildH264CodecInfo(/* adaptive= */
    true);
    assertThat(codecInfo.canReuseCodec(FORMAT_H264_HD, FORMAT_H264_4K)).isEqualTo(new DecoderReuseEvaluation(codecInfo.name, FORMAT_H264_HD, FORMAT_H264_4K, REUSE_RESULT_YES_WITH_RECONFIGURATION, /* discardReasons= */
    0));
}
Also used : DecoderReuseEvaluation(com.google.android.exoplayer2.decoder.DecoderReuseEvaluation) Test(org.junit.Test)

Example 7 with DecoderReuseEvaluation

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

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

Example 8 with DecoderReuseEvaluation

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

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

Example 9 with DecoderReuseEvaluation

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

the class DefaultAnalyticsCollector method onVideoInputFormatChanged.

@Override
// Calling deprecated listener method.
@SuppressWarnings("deprecation")
public final void onVideoInputFormatChanged(Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation) {
    EventTime eventTime = generateReadingMediaPeriodEventTime();
    sendEvent(eventTime, AnalyticsListener.EVENT_VIDEO_INPUT_FORMAT_CHANGED, listener -> {
        listener.onVideoInputFormatChanged(eventTime, format);
        listener.onVideoInputFormatChanged(eventTime, format, decoderReuseEvaluation);
        listener.onDecoderInputFormatChanged(eventTime, C.TRACK_TYPE_VIDEO, format);
    });
}
Also used : EventTime(com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)

Example 10 with DecoderReuseEvaluation

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

the class DefaultAnalyticsCollector method onAudioInputFormatChanged.

// Calling deprecated listener method.
@SuppressWarnings("deprecation")
@Override
public final void onAudioInputFormatChanged(Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation) {
    EventTime eventTime = generateReadingMediaPeriodEventTime();
    sendEvent(eventTime, AnalyticsListener.EVENT_AUDIO_INPUT_FORMAT_CHANGED, listener -> {
        listener.onAudioInputFormatChanged(eventTime, format);
        listener.onAudioInputFormatChanged(eventTime, format, decoderReuseEvaluation);
        listener.onDecoderInputFormatChanged(eventTime, C.TRACK_TYPE_AUDIO, format);
    });
}
Also used : EventTime(com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)

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