Commit 7162bd81 by olly Committed by Oliver Woodman

Propagate non-standard MIME type aliases

Issue: #5938
PiperOrigin-RevId: 261150349
parent 23ace193
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
ExoPlayer library classes. ExoPlayer library classes.
* Switch normalized BCP-47 language codes to use 2-letter ISO 639-1 language * Switch normalized BCP-47 language codes to use 2-letter ISO 639-1 language
tags instead of 3-letter ISO 639-2 language tags. tags instead of 3-letter ISO 639-2 language tags.
* Ensure the `SilenceMediaSource` position is in range
([#6229](https://github.com/google/ExoPlayer/issues/6229)).
* Fix issue where initial seek positions get ignored when playing a preroll ad * Fix issue where initial seek positions get ignored when playing a preroll ad
([#6201](https://github.com/google/ExoPlayer/issues/6201)). ([#6201](https://github.com/google/ExoPlayer/issues/6201)).
* Fix issue where invalid language tags were normalized to "und" instead of * Fix issue where invalid language tags were normalized to "und" instead of
...@@ -14,8 +16,8 @@ ...@@ -14,8 +16,8 @@
([#6153](https://github.com/google/ExoPlayer/issues/6153)). ([#6153](https://github.com/google/ExoPlayer/issues/6153)).
* Fix `DataSchemeDataSource` re-opening and range requests * Fix `DataSchemeDataSource` re-opening and range requests
([#6192](https://github.com/google/ExoPlayer/issues/6192)). ([#6192](https://github.com/google/ExoPlayer/issues/6192)).
* Ensure the `SilenceMediaSource` position is in range * Fix Flac and ALAC playback on some LG devices
([#6229](https://github.com/google/ExoPlayer/issues/6229)). ([#5938](https://github.com/google/ExoPlayer/issues/5938)).
* Flac extension: Parse `VORBIS_COMMENT` and `PICTURE` metadata * Flac extension: Parse `VORBIS_COMMENT` and `PICTURE` metadata
([#5527](https://github.com/google/ExoPlayer/issues/5527)). ([#5527](https://github.com/google/ExoPlayer/issues/5527)).
......
...@@ -393,7 +393,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media ...@@ -393,7 +393,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
codecNeedsDiscardChannelsWorkaround = codecNeedsDiscardChannelsWorkaround(codecInfo.name); codecNeedsDiscardChannelsWorkaround = codecNeedsDiscardChannelsWorkaround(codecInfo.name);
codecNeedsEosBufferTimestampWorkaround = codecNeedsEosBufferTimestampWorkaround(codecInfo.name); codecNeedsEosBufferTimestampWorkaround = codecNeedsEosBufferTimestampWorkaround(codecInfo.name);
passthroughEnabled = codecInfo.passthrough; passthroughEnabled = codecInfo.passthrough;
String codecMimeType = passthroughEnabled ? MimeTypes.AUDIO_RAW : codecInfo.mimeType; String codecMimeType = passthroughEnabled ? MimeTypes.AUDIO_RAW : codecInfo.codecMimeType;
MediaFormat mediaFormat = MediaFormat mediaFormat =
getMediaFormat(format, codecMimeType, codecMaxInputSize, codecOperatingRate); getMediaFormat(format, codecMimeType, codecMaxInputSize, codecOperatingRate);
codec.configure(mediaFormat, /* surface= */ null, crypto, /* flags= */ 0); codec.configure(mediaFormat, /* surface= */ null, crypto, /* flags= */ 0);
......
...@@ -54,8 +54,15 @@ public final class MediaCodecInfo { ...@@ -54,8 +54,15 @@ public final class MediaCodecInfo {
public final @Nullable String mimeType; public final @Nullable String mimeType;
/** /**
* The capabilities of the decoder, like the profiles/levels it supports, or {@code null} if this * The MIME type that the codec uses for media of type {@link #mimeType}, or {@code null} if this
* is a passthrough codec. * is a passthrough codec. Equal to {@link #mimeType} unless the codec is known to use a
* non-standard MIME type alias.
*/
@Nullable public final String codecMimeType;
/**
* The capabilities of the decoder, like the profiles/levels it supports, or {@code null} if not
* known.
*/ */
public final @Nullable CodecCapabilities capabilities; public final @Nullable CodecCapabilities capabilities;
...@@ -98,6 +105,7 @@ public final class MediaCodecInfo { ...@@ -98,6 +105,7 @@ public final class MediaCodecInfo {
return new MediaCodecInfo( return new MediaCodecInfo(
name, name,
/* mimeType= */ null, /* mimeType= */ null,
/* codecMimeType= */ null,
/* capabilities= */ null, /* capabilities= */ null,
/* passthrough= */ true, /* passthrough= */ true,
/* forceDisableAdaptive= */ false, /* forceDisableAdaptive= */ false,
...@@ -109,26 +117,10 @@ public final class MediaCodecInfo { ...@@ -109,26 +117,10 @@ public final class MediaCodecInfo {
* *
* @param name The name of the {@link MediaCodec}. * @param name The name of the {@link MediaCodec}.
* @param mimeType A mime type supported by the {@link MediaCodec}. * @param mimeType A mime type supported by the {@link MediaCodec}.
* @param capabilities The capabilities of the {@link MediaCodec} for the specified mime type. * @param codecMimeType The MIME type that the codec uses for media of type {@code #mimeType}.
* @return The created instance. * Equal to {@code mimeType} unless the codec is known to use a non-standard MIME type alias.
*/ * @param capabilities The capabilities of the {@link MediaCodec} for the specified mime type, or
public static MediaCodecInfo newInstance(String name, String mimeType, * {@code null} if not known.
CodecCapabilities capabilities) {
return new MediaCodecInfo(
name,
mimeType,
capabilities,
/* passthrough= */ false,
/* forceDisableAdaptive= */ false,
/* forceSecure= */ false);
}
/**
* Creates an instance.
*
* @param name The name of the {@link MediaCodec}.
* @param mimeType A mime type supported by the {@link MediaCodec}.
* @param capabilities The capabilities of the {@link MediaCodec} for the specified mime type.
* @param forceDisableAdaptive Whether {@link #adaptive} should be forced to {@code false}. * @param forceDisableAdaptive Whether {@link #adaptive} should be forced to {@code false}.
* @param forceSecure Whether {@link #secure} should be forced to {@code true}. * @param forceSecure Whether {@link #secure} should be forced to {@code true}.
* @return The created instance. * @return The created instance.
...@@ -136,22 +128,31 @@ public final class MediaCodecInfo { ...@@ -136,22 +128,31 @@ public final class MediaCodecInfo {
public static MediaCodecInfo newInstance( public static MediaCodecInfo newInstance(
String name, String name,
String mimeType, String mimeType,
CodecCapabilities capabilities, String codecMimeType,
@Nullable CodecCapabilities capabilities,
boolean forceDisableAdaptive, boolean forceDisableAdaptive,
boolean forceSecure) { boolean forceSecure) {
return new MediaCodecInfo( return new MediaCodecInfo(
name, mimeType, capabilities, /* passthrough= */ false, forceDisableAdaptive, forceSecure); name,
mimeType,
codecMimeType,
capabilities,
/* passthrough= */ false,
forceDisableAdaptive,
forceSecure);
} }
private MediaCodecInfo( private MediaCodecInfo(
String name, String name,
@Nullable String mimeType, @Nullable String mimeType,
@Nullable String codecMimeType,
@Nullable CodecCapabilities capabilities, @Nullable CodecCapabilities capabilities,
boolean passthrough, boolean passthrough,
boolean forceDisableAdaptive, boolean forceDisableAdaptive,
boolean forceSecure) { boolean forceSecure) {
this.name = Assertions.checkNotNull(name); this.name = Assertions.checkNotNull(name);
this.mimeType = mimeType; this.mimeType = mimeType;
this.codecMimeType = codecMimeType;
this.capabilities = capabilities; this.capabilities = capabilities;
this.passthrough = passthrough; this.passthrough = passthrough;
adaptive = !forceDisableAdaptive && capabilities != null && isAdaptive(capabilities); adaptive = !forceDisableAdaptive && capabilities != null && isAdaptive(capabilities);
......
...@@ -161,24 +161,17 @@ public final class MediaCodecUtil { ...@@ -161,24 +161,17 @@ public final class MediaCodecUtil {
Util.SDK_INT >= 21 Util.SDK_INT >= 21
? new MediaCodecListCompatV21(secure, tunneling) ? new MediaCodecListCompatV21(secure, tunneling)
: new MediaCodecListCompatV16(); : new MediaCodecListCompatV16();
ArrayList<MediaCodecInfo> decoderInfos = getDecoderInfosInternal(key, mediaCodecList, mimeType); ArrayList<MediaCodecInfo> decoderInfos = getDecoderInfosInternal(key, mediaCodecList);
if (secure && decoderInfos.isEmpty() && 21 <= Util.SDK_INT && Util.SDK_INT <= 23) { if (secure && decoderInfos.isEmpty() && 21 <= Util.SDK_INT && Util.SDK_INT <= 23) {
// Some devices don't list secure decoders on API level 21 [Internal: b/18678462]. Try the // Some devices don't list secure decoders on API level 21 [Internal: b/18678462]. Try the
// legacy path. We also try this path on API levels 22 and 23 as a defensive measure. // legacy path. We also try this path on API levels 22 and 23 as a defensive measure.
mediaCodecList = new MediaCodecListCompatV16(); mediaCodecList = new MediaCodecListCompatV16();
decoderInfos = getDecoderInfosInternal(key, mediaCodecList, mimeType); decoderInfos = getDecoderInfosInternal(key, mediaCodecList);
if (!decoderInfos.isEmpty()) { if (!decoderInfos.isEmpty()) {
Log.w(TAG, "MediaCodecList API didn't list secure decoder for: " + mimeType Log.w(TAG, "MediaCodecList API didn't list secure decoder for: " + mimeType
+ ". Assuming: " + decoderInfos.get(0).name); + ". Assuming: " + decoderInfos.get(0).name);
} }
} }
if (MimeTypes.AUDIO_E_AC3_JOC.equals(mimeType)) {
// E-AC3 decoders can decode JOC streams, but in 2-D rather than 3-D.
CodecKey eac3Key = new CodecKey(MimeTypes.AUDIO_E_AC3, key.secure, key.tunneling);
ArrayList<MediaCodecInfo> eac3DecoderInfos =
getDecoderInfosInternal(eac3Key, mediaCodecList, MimeTypes.AUDIO_E_AC3);
decoderInfos.addAll(eac3DecoderInfos);
}
applyWorkarounds(mimeType, decoderInfos); applyWorkarounds(mimeType, decoderInfos);
List<MediaCodecInfo> unmodifiableDecoderInfos = Collections.unmodifiableList(decoderInfos); List<MediaCodecInfo> unmodifiableDecoderInfos = Collections.unmodifiableList(decoderInfos);
decoderInfosCache.put(key, unmodifiableDecoderInfos); decoderInfosCache.put(key, unmodifiableDecoderInfos);
...@@ -249,13 +242,11 @@ public final class MediaCodecUtil { ...@@ -249,13 +242,11 @@ public final class MediaCodecUtil {
* *
* @param key The codec key. * @param key The codec key.
* @param mediaCodecList The codec list. * @param mediaCodecList The codec list.
* @param requestedMimeType The originally requested MIME type, which may differ from the codec
* key MIME type if the codec key is being considered as a fallback.
* @return The codec information for usable codecs matching the specified key. * @return The codec information for usable codecs matching the specified key.
* @throws DecoderQueryException If there was an error querying the available decoders. * @throws DecoderQueryException If there was an error querying the available decoders.
*/ */
private static ArrayList<MediaCodecInfo> getDecoderInfosInternal(CodecKey key, private static ArrayList<MediaCodecInfo> getDecoderInfosInternal(CodecKey key,
MediaCodecListCompat mediaCodecList, String requestedMimeType) throws DecoderQueryException { MediaCodecListCompat mediaCodecList) throws DecoderQueryException {
try { try {
ArrayList<MediaCodecInfo> decoderInfos = new ArrayList<>(); ArrayList<MediaCodecInfo> decoderInfos = new ArrayList<>();
String mimeType = key.mimeType; String mimeType = key.mimeType;
...@@ -265,28 +256,27 @@ public final class MediaCodecUtil { ...@@ -265,28 +256,27 @@ public final class MediaCodecUtil {
for (int i = 0; i < numberOfCodecs; i++) { for (int i = 0; i < numberOfCodecs; i++) {
android.media.MediaCodecInfo codecInfo = mediaCodecList.getCodecInfoAt(i); android.media.MediaCodecInfo codecInfo = mediaCodecList.getCodecInfoAt(i);
String name = codecInfo.getName(); String name = codecInfo.getName();
String supportedType = String codecMimeType = getCodecMimeType(codecInfo, name, secureDecodersExplicit, mimeType);
getCodecSupportedType(codecInfo, name, secureDecodersExplicit, requestedMimeType); if (codecMimeType == null) {
if (supportedType == null) {
continue; continue;
} }
try { try {
CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(supportedType); CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(codecMimeType);
boolean tunnelingSupported = boolean tunnelingSupported =
mediaCodecList.isFeatureSupported( mediaCodecList.isFeatureSupported(
CodecCapabilities.FEATURE_TunneledPlayback, supportedType, capabilities); CodecCapabilities.FEATURE_TunneledPlayback, codecMimeType, capabilities);
boolean tunnelingRequired = boolean tunnelingRequired =
mediaCodecList.isFeatureRequired( mediaCodecList.isFeatureRequired(
CodecCapabilities.FEATURE_TunneledPlayback, supportedType, capabilities); CodecCapabilities.FEATURE_TunneledPlayback, codecMimeType, capabilities);
if ((!key.tunneling && tunnelingRequired) || (key.tunneling && !tunnelingSupported)) { if ((!key.tunneling && tunnelingRequired) || (key.tunneling && !tunnelingSupported)) {
continue; continue;
} }
boolean secureSupported = boolean secureSupported =
mediaCodecList.isFeatureSupported( mediaCodecList.isFeatureSupported(
CodecCapabilities.FEATURE_SecurePlayback, supportedType, capabilities); CodecCapabilities.FEATURE_SecurePlayback, codecMimeType, capabilities);
boolean secureRequired = boolean secureRequired =
mediaCodecList.isFeatureRequired( mediaCodecList.isFeatureRequired(
CodecCapabilities.FEATURE_SecurePlayback, supportedType, capabilities); CodecCapabilities.FEATURE_SecurePlayback, codecMimeType, capabilities);
if ((!key.secure && secureRequired) || (key.secure && !secureSupported)) { if ((!key.secure && secureRequired) || (key.secure && !secureSupported)) {
continue; continue;
} }
...@@ -295,12 +285,18 @@ public final class MediaCodecUtil { ...@@ -295,12 +285,18 @@ public final class MediaCodecUtil {
|| (!secureDecodersExplicit && !key.secure)) { || (!secureDecodersExplicit && !key.secure)) {
decoderInfos.add( decoderInfos.add(
MediaCodecInfo.newInstance( MediaCodecInfo.newInstance(
name, mimeType, capabilities, forceDisableAdaptive, /* forceSecure= */ false)); name,
mimeType,
codecMimeType,
capabilities,
forceDisableAdaptive,
/* forceSecure= */ false));
} else if (!secureDecodersExplicit && secureSupported) { } else if (!secureDecodersExplicit && secureSupported) {
decoderInfos.add( decoderInfos.add(
MediaCodecInfo.newInstance( MediaCodecInfo.newInstance(
name + ".secure", name + ".secure",
mimeType, mimeType,
codecMimeType,
capabilities, capabilities,
forceDisableAdaptive, forceDisableAdaptive,
/* forceSecure= */ true)); /* forceSecure= */ true));
...@@ -314,7 +310,7 @@ public final class MediaCodecUtil { ...@@ -314,7 +310,7 @@ public final class MediaCodecUtil {
} else { } else {
// Rethrow error querying primary codec capabilities, or secondary codec // Rethrow error querying primary codec capabilities, or secondary codec
// capabilities if API level is greater than 23. // capabilities if API level is greater than 23.
Log.e(TAG, "Failed to query codec " + name + " (" + supportedType + ")"); Log.e(TAG, "Failed to query codec " + name + " (" + codecMimeType + ")");
throw e; throw e;
} }
} }
...@@ -328,48 +324,49 @@ public final class MediaCodecUtil { ...@@ -328,48 +324,49 @@ public final class MediaCodecUtil {
} }
/** /**
* Returns the codec's supported type for decoding {@code requestedMimeType} on the current * Returns the codec's supported MIME type for media of type {@code mimeType}, or {@code null} if
* device, or {@code null} if the codec can't be used. * the codec can't be used.
* *
* @param info The codec information. * @param info The codec information.
* @param name The name of the codec * @param name The name of the codec
* @param secureDecodersExplicit Whether secure decoders were explicitly listed, if present. * @param secureDecodersExplicit Whether secure decoders were explicitly listed, if present.
* @param requestedMimeType The originally requested MIME type, which may differ from the codec * @param mimeType The MIME type.
* key MIME type if the codec key is being considered as a fallback. * @return The codec's supported MIME type for media of type {@code mimeType}, or {@code null} if
* @return The codec's supported type for decoding {@code requestedMimeType}, or {@code null} if * the codec can't be used. If non-null, the returned type will be equal to {@code mimeType}
* the codec can't be used. * except in cases where the codec is known to use a non-standard MIME type alias.
*/ */
@Nullable @Nullable
private static String getCodecSupportedType( private static String getCodecMimeType(
android.media.MediaCodecInfo info, android.media.MediaCodecInfo info,
String name, String name,
boolean secureDecodersExplicit, boolean secureDecodersExplicit,
String requestedMimeType) { String mimeType) {
if (isCodecUsableDecoder(info, name, secureDecodersExplicit, requestedMimeType)) { if (!isCodecUsableDecoder(info, name, secureDecodersExplicit, mimeType)) {
String[] supportedTypes = info.getSupportedTypes(); return null;
for (String supportedType : supportedTypes) { }
if (supportedType.equalsIgnoreCase(requestedMimeType)) {
return supportedType; String[] supportedTypes = info.getSupportedTypes();
} for (String supportedType : supportedTypes) {
if (supportedType.equalsIgnoreCase(mimeType)) {
return supportedType;
} }
}
if (requestedMimeType.equals(MimeTypes.VIDEO_DOLBY_VISION)) { if (mimeType.equals(MimeTypes.VIDEO_DOLBY_VISION)) {
// Handle decoders that declare support for DV via MIME types that aren't // Handle decoders that declare support for DV via MIME types that aren't
// video/dolby-vision. // video/dolby-vision.
if ("OMX.MS.HEVCDV.Decoder".equals(name)) { if ("OMX.MS.HEVCDV.Decoder".equals(name)) {
return "video/hevcdv"; return "video/hevcdv";
} else if ("OMX.RTK.video.decoder".equals(name) } else if ("OMX.RTK.video.decoder".equals(name)
|| "OMX.realtek.video.decoder.tunneled".equals(name)) { || "OMX.realtek.video.decoder.tunneled".equals(name)) {
return "video/dv_hevc"; return "video/dv_hevc";
}
} else if (requestedMimeType.equals(MimeTypes.AUDIO_ALAC)
&& "OMX.lge.alac.decoder".equals(name)) {
return "audio/x-lg-alac";
} else if (requestedMimeType.equals(MimeTypes.AUDIO_FLAC)
&& "OMX.lge.flac.decoder".equals(name)) {
return "audio/x-lg-flac";
} }
} else if (mimeType.equals(MimeTypes.AUDIO_ALAC) && "OMX.lge.alac.decoder".equals(name)) {
return "audio/x-lg-alac";
} else if (mimeType.equals(MimeTypes.AUDIO_FLAC) && "OMX.lge.flac.decoder".equals(name)) {
return "audio/x-lg-flac";
} }
return null; return null;
} }
...@@ -379,12 +376,14 @@ public final class MediaCodecUtil { ...@@ -379,12 +376,14 @@ public final class MediaCodecUtil {
* @param info The codec information. * @param info The codec information.
* @param name The name of the codec * @param name The name of the codec
* @param secureDecodersExplicit Whether secure decoders were explicitly listed, if present. * @param secureDecodersExplicit Whether secure decoders were explicitly listed, if present.
* @param requestedMimeType The originally requested MIME type, which may differ from the codec * @param mimeType The MIME type.
* key MIME type if the codec key is being considered as a fallback.
* @return Whether the specified codec is usable for decoding on the current device. * @return Whether the specified codec is usable for decoding on the current device.
*/ */
private static boolean isCodecUsableDecoder(android.media.MediaCodecInfo info, String name, private static boolean isCodecUsableDecoder(
boolean secureDecodersExplicit, String requestedMimeType) { android.media.MediaCodecInfo info,
String name,
boolean secureDecodersExplicit,
String mimeType) {
if (info.isEncoder() || (!secureDecodersExplicit && name.endsWith(".secure"))) { if (info.isEncoder() || (!secureDecodersExplicit && name.endsWith(".secure"))) {
return false; return false;
} }
...@@ -392,11 +391,11 @@ public final class MediaCodecUtil { ...@@ -392,11 +391,11 @@ public final class MediaCodecUtil {
// Work around broken audio decoders. // Work around broken audio decoders.
if (Util.SDK_INT < 21 if (Util.SDK_INT < 21
&& ("CIPAACDecoder".equals(name) && ("CIPAACDecoder".equals(name)
|| "CIPMP3Decoder".equals(name) || "CIPMP3Decoder".equals(name)
|| "CIPVorbisDecoder".equals(name) || "CIPVorbisDecoder".equals(name)
|| "CIPAMRNBDecoder".equals(name) || "CIPAMRNBDecoder".equals(name)
|| "AACDecoder".equals(name) || "AACDecoder".equals(name)
|| "MP3Decoder".equals(name))) { || "MP3Decoder".equals(name))) {
return false; return false;
} }
...@@ -405,7 +404,7 @@ public final class MediaCodecUtil { ...@@ -405,7 +404,7 @@ public final class MediaCodecUtil {
if (Util.SDK_INT < 18 if (Util.SDK_INT < 18
&& "OMX.MTK.AUDIO.DECODER.AAC".equals(name) && "OMX.MTK.AUDIO.DECODER.AAC".equals(name)
&& ("a70".equals(Util.DEVICE) && ("a70".equals(Util.DEVICE)
|| ("Xiaomi".equals(Util.MANUFACTURER) && Util.DEVICE.startsWith("HM")))) { || ("Xiaomi".equals(Util.MANUFACTURER) && Util.DEVICE.startsWith("HM")))) {
return false; return false;
} }
...@@ -414,17 +413,17 @@ public final class MediaCodecUtil { ...@@ -414,17 +413,17 @@ public final class MediaCodecUtil {
if (Util.SDK_INT == 16 if (Util.SDK_INT == 16
&& "OMX.qcom.audio.decoder.mp3".equals(name) && "OMX.qcom.audio.decoder.mp3".equals(name)
&& ("dlxu".equals(Util.DEVICE) // HTC Butterfly && ("dlxu".equals(Util.DEVICE) // HTC Butterfly
|| "protou".equals(Util.DEVICE) // HTC Desire X || "protou".equals(Util.DEVICE) // HTC Desire X
|| "ville".equals(Util.DEVICE) // HTC One S || "ville".equals(Util.DEVICE) // HTC One S
|| "villeplus".equals(Util.DEVICE) || "villeplus".equals(Util.DEVICE)
|| "villec2".equals(Util.DEVICE) || "villec2".equals(Util.DEVICE)
|| Util.DEVICE.startsWith("gee") // LGE Optimus G || Util.DEVICE.startsWith("gee") // LGE Optimus G
|| "C6602".equals(Util.DEVICE) // Sony Xperia Z || "C6602".equals(Util.DEVICE) // Sony Xperia Z
|| "C6603".equals(Util.DEVICE) || "C6603".equals(Util.DEVICE)
|| "C6606".equals(Util.DEVICE) || "C6606".equals(Util.DEVICE)
|| "C6616".equals(Util.DEVICE) || "C6616".equals(Util.DEVICE)
|| "L36h".equals(Util.DEVICE) || "L36h".equals(Util.DEVICE)
|| "SO-02E".equals(Util.DEVICE))) { || "SO-02E".equals(Util.DEVICE))) {
return false; return false;
} }
...@@ -432,9 +431,9 @@ public final class MediaCodecUtil { ...@@ -432,9 +431,9 @@ public final class MediaCodecUtil {
if (Util.SDK_INT == 16 if (Util.SDK_INT == 16
&& "OMX.qcom.audio.decoder.aac".equals(name) && "OMX.qcom.audio.decoder.aac".equals(name)
&& ("C1504".equals(Util.DEVICE) // Sony Xperia E && ("C1504".equals(Util.DEVICE) // Sony Xperia E
|| "C1505".equals(Util.DEVICE) || "C1505".equals(Util.DEVICE)
|| "C1604".equals(Util.DEVICE) // Sony Xperia E dual || "C1604".equals(Util.DEVICE) // Sony Xperia E dual
|| "C1605".equals(Util.DEVICE))) { || "C1605".equals(Util.DEVICE))) {
return false; return false;
} }
...@@ -443,13 +442,13 @@ public final class MediaCodecUtil { ...@@ -443,13 +442,13 @@ public final class MediaCodecUtil {
&& ("OMX.SEC.aac.dec".equals(name) || "OMX.Exynos.AAC.Decoder".equals(name)) && ("OMX.SEC.aac.dec".equals(name) || "OMX.Exynos.AAC.Decoder".equals(name))
&& "samsung".equals(Util.MANUFACTURER) && "samsung".equals(Util.MANUFACTURER)
&& (Util.DEVICE.startsWith("zeroflte") // Galaxy S6 && (Util.DEVICE.startsWith("zeroflte") // Galaxy S6
|| Util.DEVICE.startsWith("zerolte") // Galaxy S6 Edge || Util.DEVICE.startsWith("zerolte") // Galaxy S6 Edge
|| Util.DEVICE.startsWith("zenlte") // Galaxy S6 Edge+ || Util.DEVICE.startsWith("zenlte") // Galaxy S6 Edge+
|| "SC-05G".equals(Util.DEVICE) // Galaxy S6 || "SC-05G".equals(Util.DEVICE) // Galaxy S6
|| "marinelteatt".equals(Util.DEVICE) // Galaxy S6 Active || "marinelteatt".equals(Util.DEVICE) // Galaxy S6 Active
|| "404SC".equals(Util.DEVICE) // Galaxy S6 Edge || "404SC".equals(Util.DEVICE) // Galaxy S6 Edge
|| "SC-04G".equals(Util.DEVICE) || "SC-04G".equals(Util.DEVICE)
|| "SCV31".equals(Util.DEVICE))) { || "SCV31".equals(Util.DEVICE))) {
return false; return false;
} }
...@@ -459,10 +458,10 @@ public final class MediaCodecUtil { ...@@ -459,10 +458,10 @@ public final class MediaCodecUtil {
&& "OMX.SEC.vp8.dec".equals(name) && "OMX.SEC.vp8.dec".equals(name)
&& "samsung".equals(Util.MANUFACTURER) && "samsung".equals(Util.MANUFACTURER)
&& (Util.DEVICE.startsWith("d2") && (Util.DEVICE.startsWith("d2")
|| Util.DEVICE.startsWith("serrano") || Util.DEVICE.startsWith("serrano")
|| Util.DEVICE.startsWith("jflte") || Util.DEVICE.startsWith("jflte")
|| Util.DEVICE.startsWith("santos") || Util.DEVICE.startsWith("santos")
|| Util.DEVICE.startsWith("t0"))) { || Util.DEVICE.startsWith("t0"))) {
return false; return false;
} }
...@@ -473,7 +472,7 @@ public final class MediaCodecUtil { ...@@ -473,7 +472,7 @@ public final class MediaCodecUtil {
} }
// MTK E-AC3 decoder doesn't support decoding JOC streams in 2-D. See [Internal: b/69400041]. // MTK E-AC3 decoder doesn't support decoding JOC streams in 2-D. See [Internal: b/69400041].
if (MimeTypes.AUDIO_E_AC3_JOC.equals(requestedMimeType) if (MimeTypes.AUDIO_E_AC3_JOC.equals(mimeType)
&& "OMX.MTK.AUDIO.DECODER.DSPAC3".equals(name)) { && "OMX.MTK.AUDIO.DECODER.DSPAC3".equals(name)) {
return false; return false;
} }
......
...@@ -551,10 +551,12 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -551,10 +551,12 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
Format format, Format format,
MediaCrypto crypto, MediaCrypto crypto,
float codecOperatingRate) { float codecOperatingRate) {
String codecMimeType = codecInfo.codecMimeType;
codecMaxValues = getCodecMaxValues(codecInfo, format, getStreamFormats()); codecMaxValues = getCodecMaxValues(codecInfo, format, getStreamFormats());
MediaFormat mediaFormat = MediaFormat mediaFormat =
getMediaFormat( getMediaFormat(
format, format,
codecMimeType,
codecMaxValues, codecMaxValues,
codecOperatingRate, codecOperatingRate,
deviceNeedsNoPostProcessWorkaround, deviceNeedsNoPostProcessWorkaround,
...@@ -1111,6 +1113,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -1111,6 +1113,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
* Returns the framework {@link MediaFormat} that should be used to configure the decoder. * Returns the framework {@link MediaFormat} that should be used to configure the decoder.
* *
* @param format The format of media. * @param format The format of media.
* @param codecMimeType The MIME type handled by the codec.
* @param codecMaxValues Codec max values that should be used when configuring the decoder. * @param codecMaxValues Codec max values that should be used when configuring the decoder.
* @param codecOperatingRate The codec operating rate, or {@link #CODEC_OPERATING_RATE_UNSET} if * @param codecOperatingRate The codec operating rate, or {@link #CODEC_OPERATING_RATE_UNSET} if
* no codec operating rate should be set. * no codec operating rate should be set.
...@@ -1123,13 +1126,14 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -1123,13 +1126,14 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
@SuppressLint("InlinedApi") @SuppressLint("InlinedApi")
protected MediaFormat getMediaFormat( protected MediaFormat getMediaFormat(
Format format, Format format,
String codecMimeType,
CodecMaxValues codecMaxValues, CodecMaxValues codecMaxValues,
float codecOperatingRate, float codecOperatingRate,
boolean deviceNeedsNoPostProcessWorkaround, boolean deviceNeedsNoPostProcessWorkaround,
int tunnelingAudioSessionId) { int tunnelingAudioSessionId) {
MediaFormat mediaFormat = new MediaFormat(); MediaFormat mediaFormat = new MediaFormat();
// Set format parameters that should always be set. // Set format parameters that should always be set.
mediaFormat.setString(MediaFormat.KEY_MIME, format.sampleMimeType); mediaFormat.setString(MediaFormat.KEY_MIME, codecMimeType);
mediaFormat.setInteger(MediaFormat.KEY_WIDTH, format.width); mediaFormat.setInteger(MediaFormat.KEY_WIDTH, format.width);
mediaFormat.setInteger(MediaFormat.KEY_HEIGHT, format.height); mediaFormat.setInteger(MediaFormat.KEY_HEIGHT, format.height);
MediaFormatUtil.setCsdBuffers(mediaFormat, format.initializationData); MediaFormatUtil.setCsdBuffers(mediaFormat, format.initializationData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment