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]); |