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

Unified Diff: net/base/mime_util.cc

Issue 230413003: Adding platform specific checks for VP9 codecs and HLS mime types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding comments Created 6 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
« no previous file with comments | « content/browser/media/media_canplaytype_browsertest.cc ('k') | net/base/mime_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/mime_util.cc
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index fdb16fd8f7ef0b0f22b2d2e232198587ce19344d..174d19e2482863ac2254ba8fe9cdc5bb6fac280e 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -411,6 +411,10 @@ static const char* const supported_javascript_types[] = {
#if defined(OS_ANDROID)
static bool IsCodecSupportedOnAndroid(const std::string& codec) {
+ // Theora is not supported in Android
+ if (!codec.compare("theora"))
+ return false;
+
// VP9 is supported only in KitKat+ (API Level 19).
if ((!codec.compare("vp9") || !codec.compare("vp9.0")) &&
base::android::BuildInfo::GetInstance()->sdk_int() < 19) {
@@ -424,6 +428,16 @@ static bool IsCodecSupportedOnAndroid(const std::string& codec) {
}
return true;
}
+
+static bool IsMimeTypeSupportedOnAndroid(const std::string& mimeType) {
+ // HLS codecs are supported in ICS and above (API level 14)
+ if ((!mimeType.compare("application/vnd.apple.mpegurl") ||
+ !mimeType.compare("application/x-mpegurl")) &&
+ base::android::BuildInfo::GetInstance()->sdk_int() < 14) {
+ return false;
+ }
+ return true;
+}
#endif
struct MediaFormatStrict {
@@ -474,16 +488,26 @@ void MimeUtil::InitializeMimeTypeMaps() {
unsupported_text_map_.insert(unsupported_text_types[i]);
for (size_t i = 0; i < arraysize(supported_javascript_types); ++i)
non_image_map_.insert(supported_javascript_types[i]);
- for (size_t i = 0; i < arraysize(common_media_types); ++i)
+ for (size_t i = 0; i < arraysize(common_media_types); ++i) {
+#if defined(OS_ANDROID)
+ if (!IsMimeTypeSupportedOnAndroid(common_media_types[i]))
+ continue;
+#endif
non_image_map_.insert(common_media_types[i]);
+ }
#if defined(USE_PROPRIETARY_CODECS)
for (size_t i = 0; i < arraysize(proprietary_media_types); ++i)
non_image_map_.insert(proprietary_media_types[i]);
#endif
// Initialize the supported media types.
- for (size_t i = 0; i < arraysize(common_media_types); ++i)
+ for (size_t i = 0; i < arraysize(common_media_types); ++i) {
+#if defined(OS_ANDROID)
+ if (!IsMimeTypeSupportedOnAndroid(common_media_types[i]))
+ continue;
+#endif
media_map_.insert(common_media_types[i]);
+ }
#if defined(USE_PROPRIETARY_CODECS)
for (size_t i = 0; i < arraysize(proprietary_media_types); ++i)
media_map_.insert(proprietary_media_types[i]);
« no previous file with comments | « content/browser/media/media_canplaytype_browsertest.cc ('k') | net/base/mime_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698