Wider fix for OMX.SEC.mp3.dec issue
Issue: #4519 PiperOrigin-RevId: 232299233
This commit is contained in:
parent
41689fdef7
commit
f8772fda21
@ -10,6 +10,8 @@
|
||||
* IMA extension: Upgrade IMA dependency to 3.10.6.
|
||||
* Cronet extension: Upgrade Cronet dependency to 71.3578.98.
|
||||
* OkHttp extension: Upgrade OkHttp dependency to 3.12.1.
|
||||
* MP3: Wider fix for issue where streams would play twice on some Samsung
|
||||
devices ([#4519](https://github.com/google/ExoPlayer/issues/4519)).
|
||||
|
||||
### 2.9.4 ###
|
||||
|
||||
|
@ -59,8 +59,6 @@ public final class MediaCodecUtil {
|
||||
|
||||
private static final String TAG = "MediaCodecUtil";
|
||||
private static final Pattern PROFILE_PATTERN = Pattern.compile("^\\D?(\\d+)$");
|
||||
private static final RawAudioCodecComparator RAW_AUDIO_CODEC_COMPARATOR =
|
||||
new RawAudioCodecComparator();
|
||||
|
||||
private static final HashMap<CodecKey, List<MediaCodecInfo>> decoderInfosCache = new HashMap<>();
|
||||
|
||||
@ -312,32 +310,6 @@ public final class MediaCodecUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Work around https://github.com/google/ExoPlayer/issues/398.
|
||||
if (Util.SDK_INT < 18 && "OMX.SEC.MP3.Decoder".equals(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Work around https://github.com/google/ExoPlayer/issues/4519.
|
||||
if ("OMX.SEC.mp3.dec".equals(name)
|
||||
&& (Util.MODEL.startsWith("GT-I9152")
|
||||
|| Util.MODEL.startsWith("GT-I9515")
|
||||
|| Util.MODEL.startsWith("GT-P5220")
|
||||
|| Util.MODEL.startsWith("GT-S7580")
|
||||
|| Util.MODEL.startsWith("SM-G350")
|
||||
|| Util.MODEL.startsWith("SM-G386")
|
||||
|| Util.MODEL.startsWith("SM-T231")
|
||||
|| Util.MODEL.startsWith("SM-T530")
|
||||
|| Util.MODEL.startsWith("SCH-I535")
|
||||
|| Util.MODEL.startsWith("SPH-L710"))) {
|
||||
return false;
|
||||
}
|
||||
if ("OMX.brcm.audio.mp3.decoder".equals(name)
|
||||
&& (Util.MODEL.startsWith("GT-I9152")
|
||||
|| Util.MODEL.startsWith("GT-S7580")
|
||||
|| Util.MODEL.startsWith("SM-G350"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Work around https://github.com/google/ExoPlayer/issues/1528 and
|
||||
// https://github.com/google/ExoPlayer/issues/3171.
|
||||
if (Util.SDK_INT < 18 && "OMX.MTK.AUDIO.DECODER.AAC".equals(name)
|
||||
@ -424,7 +396,18 @@ public final class MediaCodecUtil {
|
||||
*/
|
||||
private static void applyWorkarounds(String mimeType, List<MediaCodecInfo> decoderInfos) {
|
||||
if (MimeTypes.AUDIO_RAW.equals(mimeType)) {
|
||||
Collections.sort(decoderInfos, RAW_AUDIO_CODEC_COMPARATOR);
|
||||
Collections.sort(decoderInfos, new RawAudioCodecComparator());
|
||||
} else if (Util.SDK_INT < 21 && decoderInfos.size() > 1) {
|
||||
String firstCodecName = decoderInfos.get(0).name;
|
||||
if ("OMX.SEC.mp3.dec".equals(firstCodecName)
|
||||
|| "OMX.SEC.MP3.Decoder".equals(firstCodecName)
|
||||
|| "OMX.brcm.audio.mp3.decoder".equals(firstCodecName)) {
|
||||
// Prefer OMX.google codecs over OMX.SEC.mp3.dec, OMX.SEC.MP3.Decoder and
|
||||
// OMX.brcm.audio.mp3.decoder on older devices. See:
|
||||
// https://github.com/google/ExoPlayer/issues/398 and
|
||||
// https://github.com/google/ExoPlayer/issues/4519.
|
||||
Collections.sort(decoderInfos, new PreferOmxGoogleCodecComparator());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -730,6 +713,18 @@ public final class MediaCodecUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/** Comparator for preferring OMX.google media codecs. */
|
||||
private static final class PreferOmxGoogleCodecComparator implements Comparator<MediaCodecInfo> {
|
||||
@Override
|
||||
public int compare(MediaCodecInfo a, MediaCodecInfo b) {
|
||||
return scoreMediaCodecInfo(a) - scoreMediaCodecInfo(b);
|
||||
}
|
||||
|
||||
private static int scoreMediaCodecInfo(MediaCodecInfo mediaCodecInfo) {
|
||||
return mediaCodecInfo.name.startsWith("OMX.google") ? -1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
AVC_PROFILE_NUMBER_TO_CONST = new SparseIntArray();
|
||||
AVC_PROFILE_NUMBER_TO_CONST.put(66, CodecProfileLevel.AVCProfileBaseline);
|
||||
|
Loading…
x
Reference in New Issue
Block a user