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

Unified Diff: media/base/android/media_codec_util.cc

Issue 2686963002: Fix and update MediaCodec blacklist. (Closed)
Patch Set: added E-TAB4 Created 3 years, 10 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/media_codec_util.cc
diff --git a/media/base/android/media_codec_util.cc b/media/base/android/media_codec_util.cc
index 171991d4ba4e46eff6f2a4e4715238051ae921d6..e2d83f4eee5448e484373b74725c3810b701fa56 100644
--- a/media/base/android/media_codec_util.cc
+++ b/media/base/android/media_codec_util.cc
@@ -7,12 +7,14 @@
#include <stddef.h>
#include <algorithm>
+#include <vector>
#include "base/android/build_info.h"
#include "base/android/jni_android.h"
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/logging.h"
+#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "jni/MediaCodecUtil_jni.h"
#include "media/base/android/media_codec_bridge.h"
@@ -23,6 +25,9 @@ using base::android::ConvertJavaStringToUTF8;
using base::android::ConvertUTF8ToJavaString;
using base::android::JavaIntArrayToIntVector;
using base::android::ScopedJavaLocalRef;
+using base::android::SDK_VERSION_JELLY_BEAN_MR2;
+using base::android::SDK_VERSION_KITKAT;
+using base::android::SDK_VERSION_LOLLIPOP_MR1;
namespace media {
@@ -104,26 +109,63 @@ static bool IsEncoderSupportedByDevice(const std::string& android_mime_type) {
// static
bool MediaCodecUtil::IsMediaCodecAvailable() {
+ return IsMediaCodecAvailableForSdk(
+ base::android::BuildInfo::GetInstance()->sdk_int(),
+ base::android::BuildInfo::GetInstance()->model());
+}
+
+// static
+bool MediaCodecUtil::IsMediaCodecAvailableForSdk(int sdk, const char* model) {
watk 2017/02/10 22:14:13 nit: Either make it "ForDevice" or remove the suff
liberato (no reviews please) 2017/02/13 21:24:09 true, but it's not just the device, either. :) i
// Blacklist some devices on Jellybean as MediaCodec is buggy.
// http://crbug.com/365494, http://crbug.com/615872
// Blacklist Lenovo A6600 / A6800 on KitKat, which tends to crash a lot.
// See crbug.com/628059 . We include < K since they don't exist.
// Blacklist Samsung Galaxy Star Pro (GT-S7262) (crbug.com/634920).
// GT-S5282 and GT-I8552 are for crbug.com/634920 .
- if (base::android::BuildInfo::GetInstance()->sdk_int() <= 19) {
- std::string model(base::android::BuildInfo::GetInstance()->model());
- return model != "GT-I9100" && model != "GT-I9300" && model != "GT-N7000" &&
- model != "GT-N7100" && model != "A6600" && model != "A6800" &&
- model != "GT-S7262" && model != "GT-S5282" && model != "GT-I8552";
- } else if (base::android::BuildInfo::GetInstance()->sdk_int() < 19) {
- // For JB, these tend to fail often (crbug.com/654905), but not with K+.
- std::string model(base::android::BuildInfo::GetInstance()->model());
- return model != "GT-P3113" && model != "GT-P5110" && model != "GT-P5100" &&
- model != "GT-P5113" && model != "GT-P3110" && model != "GT-N5110" &&
- model != "e-tab4" && model != "GT-I8200Q";
- }
+ // Blacklist LGMS330 on L for crbug.com/654905 .
watk 2017/02/10 22:14:13 Why don't we just intersperse the crbug # comments
liberato (no reviews please) 2017/02/13 21:24:09 Done.
- return true;
+ // None of our tests fail >= marshmallow.
+ if (sdk >= base::android::SDK_VERSION_MARSHMALLOW)
aelias_OOO_until_Jul13 2017/02/10 21:57:46 This line doesn't do anything and it might cause a
liberato (no reviews please) 2017/02/13 21:24:09 Done.
+ return true;
+
+ // ["model name"] == last bad revision. We will blacklist the model on any
watk 2017/02/10 22:14:13 "["model name"] == last bad revision." no longer r
liberato (no reviews please) 2017/02/13 21:24:09 Done.
+ // sdk that is as old or older.
+ struct BlacklistEntry {
+ BlacklistEntry(const char* m, int s) : model(m), last_bad_sdk(s) {}
+ base::StringPiece model;
+ int last_bad_sdk;
+ bool operator==(const BlacklistEntry& other) const {
+ // Search on name only. Ignore |last_bad_sdk|.
+ return model == other.model;
+ }
+ };
+ static const std::vector<BlacklistEntry> blacklist = {
+ {"LGMS330", SDK_VERSION_LOLLIPOP_MR1},
+
+ {"GT-I9100", SDK_VERSION_KITKAT},
+ {"GT-I9300", SDK_VERSION_KITKAT},
+ {"GT-N7000", SDK_VERSION_KITKAT},
+ {"GT-N7100", SDK_VERSION_KITKAT},
+ {"A6600", SDK_VERSION_KITKAT},
+ {"A6800", SDK_VERSION_KITKAT},
+ {"GT-S7262", SDK_VERSION_KITKAT},
+ {"GT-S5282", SDK_VERSION_KITKAT},
+ {"GT-I8552", SDK_VERSION_KITKAT},
+
+ {"GT-P3113", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-P5110", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-P5100", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-P5113", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-P3110", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-N5110", SDK_VERSION_JELLY_BEAN_MR2},
+ {"e-tab4", SDK_VERSION_JELLY_BEAN_MR2},
+ {"E-TAB4", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-I8200Q", SDK_VERSION_JELLY_BEAN_MR2},
+ };
+
+ const auto iter =
+ std::find(blacklist.begin(), blacklist.end(), BlacklistEntry(model, 0));
+ return iter == blacklist.end() || sdk > iter->last_bad_sdk;
}
// static

Powered by Google App Engine
This is Rietveld 408576698