Use bypass for PCM if AudioTrack supports it
Codec bypass is now enabled for all formats audio track supports. PiperOrigin-RevId: 324987842
This commit is contained in:
parent
d2e50e40dc
commit
5342576e73
@ -201,6 +201,7 @@
|
|||||||
decoders.
|
decoders.
|
||||||
* Add floating point PCM output capability in `MediaCodecAudioRenderer`,
|
* Add floating point PCM output capability in `MediaCodecAudioRenderer`,
|
||||||
and `LibopusAudioRenderer`.
|
and `LibopusAudioRenderer`.
|
||||||
|
* Do not use a MediaCodec for PCM formats if AudioTrack supports it.
|
||||||
* DASH:
|
* DASH:
|
||||||
* Enable support for embedded CEA-708.
|
* Enable support for embedded CEA-708.
|
||||||
* Add support for load cancelation when discarding upstream
|
* Add support for load cancelation when discarding upstream
|
||||||
|
@ -219,7 +219,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
|||||||
// In direct mode, if the format has DRM then we need to use a decoder that only decrypts.
|
// In direct mode, if the format has DRM then we need to use a decoder that only decrypts.
|
||||||
// Else we don't don't need a decoder at all.
|
// Else we don't don't need a decoder at all.
|
||||||
if (supportsFormatDrm
|
if (supportsFormatDrm
|
||||||
&& isDirectPlaybackSupported(format)
|
&& audioSink.supportsFormat(format)
|
||||||
&& (!formatHasDrm || MediaCodecUtil.getDecryptOnlyDecoderInfo() != null)) {
|
&& (!formatHasDrm || MediaCodecUtil.getDecryptOnlyDecoderInfo() != null)) {
|
||||||
return RendererCapabilities.create(FORMAT_HANDLED, ADAPTIVE_NOT_SEAMLESS, tunnelingSupport);
|
return RendererCapabilities.create(FORMAT_HANDLED, ADAPTIVE_NOT_SEAMLESS, tunnelingSupport);
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
|||||||
if (mimeType == null) {
|
if (mimeType == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
if (isDirectPlaybackSupported(format)) {
|
if (audioSink.supportsFormat(format)) {
|
||||||
// The format is supported directly, so a codec is only needed for decryption.
|
// The format is supported directly, so a codec is only needed for decryption.
|
||||||
@Nullable MediaCodecInfo codecInfo = MediaCodecUtil.getDecryptOnlyDecoderInfo();
|
@Nullable MediaCodecInfo codecInfo = MediaCodecUtil.getDecryptOnlyDecoderInfo();
|
||||||
if (codecInfo != null) {
|
if (codecInfo != null) {
|
||||||
@ -286,7 +286,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldUseBypass(Format format) {
|
protected boolean shouldUseBypass(Format format) {
|
||||||
return isDirectPlaybackSupported(format);
|
return audioSink.supportsFormat(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -675,16 +675,6 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
|||||||
return maxInputSize;
|
return maxInputSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns if the format can be played as is to the audio sink. */
|
|
||||||
private boolean isDirectPlaybackSupported(Format format) {
|
|
||||||
@Nullable String mimeType = format.sampleMimeType;
|
|
||||||
if (MimeTypes.AUDIO_RAW.equals(mimeType)) {
|
|
||||||
// Decoding bypass for PCM is not yet supported.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return audioSink.supportsFormat(format);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a maximum input buffer size for a given {@link Format}.
|
* Returns a maximum input buffer size for a given {@link Format}.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user