use of androidx.media3.exoplayer.DecoderReuseEvaluation in project media by androidx.
the class MediaCodecAudioRenderer method canReuseCodec.
@Override
protected DecoderReuseEvaluation canReuseCodec(MediaCodecInfo codecInfo, Format oldFormat, Format newFormat) {
DecoderReuseEvaluation evaluation = codecInfo.canReuseCodec(oldFormat, newFormat);
@DecoderDiscardReasons int discardReasons = evaluation.discardReasons;
if (getCodecMaxInputSize(codecInfo, newFormat) > codecMaxInputSize) {
discardReasons |= DISCARD_REASON_MAX_INPUT_SIZE_EXCEEDED;
}
return new DecoderReuseEvaluation(codecInfo.name, oldFormat, newFormat, discardReasons != 0 ? REUSE_RESULT_NO : evaluation.result, discardReasons);
}
use of androidx.media3.exoplayer.DecoderReuseEvaluation in project media by androidx.
the class MediaCodecAudioRenderer method onInputFormatChanged.
@Override
@Nullable
protected DecoderReuseEvaluation onInputFormatChanged(FormatHolder formatHolder) throws ExoPlaybackException {
@Nullable DecoderReuseEvaluation evaluation = super.onInputFormatChanged(formatHolder);
eventDispatcher.inputFormatChanged(formatHolder.format, evaluation);
return evaluation;
}
use of androidx.media3.exoplayer.DecoderReuseEvaluation in project media by androidx.
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);
});
}
use of androidx.media3.exoplayer.DecoderReuseEvaluation in project media by androidx.
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));
}
use of androidx.media3.exoplayer.DecoderReuseEvaluation in project media by androidx.
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));
}
Aggregations