Add device-specific workarounds for VP8 and MP3.

Avoid using the VP8 decoder on Samsung Galaxy S4 Mini.
Issue: #548

Avoid using the MP3 decoder on Sony Xperia Z/API level 16.
Issue: #377
This commit is contained in:
Andrew Lewis 2015-07-10 11:47:24 +01:00
parent c47c6816e4
commit 2358004951
2 changed files with 16 additions and 3 deletions

View file

@ -175,15 +175,22 @@ public class MediaCodecUtil {
return false;
}
// Workaround an issue where creating a particular MP3 decoder on some HTC devices on platform
// API version 16 crashes mediaserver.
// Work around an issue where creating a particular MP3 decoder on some devices on platform API
// version 16 crashes mediaserver.
if (Util.SDK_INT == 16
&& ("dlxu".equals(Util.DEVICE) // HTC Butterfly
|| "protou".equals(Util.DEVICE)) // HTC Desire X
|| "protou".equals(Util.DEVICE) // HTC Desire X
|| "C6602".equals(Util.DEVICE) || "C6603".equals(Util.DEVICE)) // Sony Xperia Z
&& name.equals("OMX.qcom.audio.decoder.mp3")) {
return false;
}
// Work around an issue where the VP8 decoder on Samsung Galaxy S4 Mini does not render video.
if (Util.SDK_INT <= 19 && Util.DEVICE != null && Util.DEVICE.startsWith("serrano")
&& "samsung".equals(Util.MANUFACTURER) && name.equals("OMX.SEC.vp8.dec")) {
return false;
}
return true;
}

View file

@ -69,6 +69,12 @@ public final class Util {
*/
public static final String DEVICE = android.os.Build.DEVICE;
/**
* Like {@link android.os.Build#MANUFACTURER}, but in a place where it can be conveniently
* overridden for local testing.
*/
public static final String MANUFACTURER = android.os.Build.MANUFACTURER;
private static final Pattern XS_DATE_TIME_PATTERN = Pattern.compile(
"(\\d\\d\\d\\d)\\-(\\d\\d)\\-(\\d\\d)[Tt]"
+ "(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d+))?"