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.
|
||||
* Add floating point PCM output capability in `MediaCodecAudioRenderer`,
|
||||
and `LibopusAudioRenderer`.
|
||||
* Do not use a MediaCodec for PCM formats if AudioTrack supports it.
|
||||
* DASH:
|
||||
* Enable support for embedded CEA-708.
|
||||
* 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.
|
||||
// Else we don't don't need a decoder at all.
|
||||
if (supportsFormatDrm
|
||||
&& isDirectPlaybackSupported(format)
|
||||
&& audioSink.supportsFormat(format)
|
||||
&& (!formatHasDrm || MediaCodecUtil.getDecryptOnlyDecoderInfo() != null)) {
|
||||
return RendererCapabilities.create(FORMAT_HANDLED, ADAPTIVE_NOT_SEAMLESS, tunnelingSupport);
|
||||
}
|
||||
@ -262,7 +262,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
if (mimeType == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (isDirectPlaybackSupported(format)) {
|
||||
if (audioSink.supportsFormat(format)) {
|
||||
// The format is supported directly, so a codec is only needed for decryption.
|
||||
@Nullable MediaCodecInfo codecInfo = MediaCodecUtil.getDecryptOnlyDecoderInfo();
|
||||
if (codecInfo != null) {
|
||||
@ -286,7 +286,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
|
||||
@Override
|
||||
protected boolean shouldUseBypass(Format format) {
|
||||
return isDirectPlaybackSupported(format);
|
||||
return audioSink.supportsFormat(format);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -675,16 +675,6 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
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}.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user