Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: media/base/android/java/src/org/chromium/media/MediaCodecUtil.java

Issue 1869103002: Enable adaptive playback for spitzer, use conservative size. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cl feedback. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/base/android/java/src/org/chromium/media/MediaCodecUtil.java
diff --git a/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java b/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java
index 5599b459c7e2f74e53bbfd331d02bf36928487be..e392c6ebdaea331b9a59c1e89157ac1229a2890b 100644
--- a/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java
+++ b/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java
@@ -234,6 +234,29 @@ class MediaCodecUtil {
}
/**
+ * Returns true if and only enabling adaptive playback is unsafe. On some
+ * device / os combinations, enabling it causes decoded frames to be
+ * unusable. For example, the S3 on 4.4.2 returns black and white, tiled
+ * frames when this is enabled.
+ */
+ private static boolean isAdaptivePlaybackBlacklisted(String mime) {
+ if (!mime.equals("video/avc") && !mime.equals("video/avc1")) {
+ return false;
+ }
+
+ if (!Build.VERSION.RELEASE.equals("4.4.2")) {
+ return false;
+ }
+
+ if (!Build.MANUFACTURER.toLowerCase(Locale.getDefault()).equals("samsung")) {
+ return false;
+ }
+
+ return Build.MODEL.startsWith("GT-I9300") || // S3 (I9300 / I9300I)
+ Build.MODEL.startsWith("SCH-I535"); // S3
+ }
+
+ /**
* Returns true if the given codec supports adaptive playback (dynamic resolution change).
* @param mediaCodec the codec.
* @param mime MIME type that corresponds to the codec creation.
@@ -249,6 +272,11 @@ class MediaCodecUtil {
if (info.isEncoder()) {
return false;
}
+
+ if (isAdaptivePlaybackBlacklisted(mime)) {
+ return false;
+ }
+
MediaCodecInfo.CodecCapabilities capabilities = info.getCapabilitiesForType(mime);
return (capabilities != null)
&& capabilities.isFeatureSupported(

Powered by Google App Engine
This is Rietveld 408576698