A passthrough codec is only needed for DRM

In passthrough MediaCodec is not used except if
the format has a DRM.

Nevertheless the code was still requiring that a
passthrough decoder be present even if it was not going to be
used (aka no drm).

PiperOrigin-RevId: 309947271
This commit is contained in:
krocard 2020-05-05 16:06:54 +01:00 committed by Oliver Woodman
parent 5117138481
commit 81a13a638d

View File

@ -219,7 +219,8 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
boolean supportsFormatDrm = supportsFormatDrm(format); boolean supportsFormatDrm = supportsFormatDrm(format);
if (supportsFormatDrm if (supportsFormatDrm
&& usePassthrough(format.channelCount, mimeType) && usePassthrough(format.channelCount, mimeType)
&& MediaCodecUtil.getPassthroughDecoderInfo() != null) { // A Passthrough decoder is only needed to decode the DRM encryption.
&& (format.drmInitData == null || MediaCodecUtil.getPassthroughDecoderInfo() != null)) {
return RendererCapabilities.create(FORMAT_HANDLED, ADAPTIVE_NOT_SEAMLESS, tunnelingSupport); return RendererCapabilities.create(FORMAT_HANDLED, ADAPTIVE_NOT_SEAMLESS, tunnelingSupport);
} }
if ((MimeTypes.AUDIO_RAW.equals(mimeType) if ((MimeTypes.AUDIO_RAW.equals(mimeType)