Index: net/base/mime_util.cc |
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc |
index 9d15256172ff9fc99f2a5c9e27021cfd785a6263..5062ab54b2e5224a953affbbd18bc38e0bdd231d 100644 |
--- a/net/base/mime_util.cc |
+++ b/net/base/mime_util.cc |
@@ -473,7 +473,11 @@ static const MediaFormatStrict format_codec_mappings[] = { |
{ "video/ogg", "opus,theora,vorbis" }, |
{ "audio/ogg", "opus,vorbis" }, |
{ "application/ogg", "opus,theora,vorbis" }, |
- { "audio/mpeg", "" }, |
+ { "audio/mpeg", ",mp3" }, // Note: Empty string codec ID indicates |
DaleCurtis
2014/07/17 18:41:55
I'm not convinced it's a good idea, but I wonder i
acolwell GONE FROM CHROMIUM
2014/07/17 18:57:00
I agree that this isn't awesome, but I fear some s
|
+ // a missing codecs= parameter is also valid. |
+ // The presense of 'mp3' is not RFC compliant, |
+ // but is common in the wild so it is a defacto |
+ // standard. |
{ "audio/mp3", "" }, |
{ "audio/x-mp3", "" } |
}; |
@@ -519,11 +523,18 @@ bool MimeUtil::AreSupportedCodecs(const MimeMappings& supported_codecs, |
if (supported_codecs.empty()) |
return codecs.empty(); |
+ // If no codecs are specified in the mimetype, check to see if a missing |
+ // codecs parameter is allowed. |
+ if (codecs.empty()) |
+ return supported_codecs.find("") != supported_codecs.end(); |
Ryan Sleevi
2014/07/17 18:38:08
.find(std::string())
acolwell GONE FROM CHROMIUM
2014/07/17 18:57:00
Done.
|
+ |
for (size_t i = 0; i < codecs.size(); ++i) { |
- if (supported_codecs.find(codecs[i]) == supported_codecs.end()) |
+ if (supported_codecs.find(codecs[i]) == supported_codecs.end() || |
+ codecs[i].empty()) |
Ryan Sleevi
2014/07/17 18:38:08
Do the .empty() check before the .find(), and avoi
acolwell GONE FROM CHROMIUM
2014/07/17 18:57:00
Done.
|
return false; |
} |
- return !codecs.empty(); |
+ |
+ return true; |
} |
// Checks all the codecs present in the |codecs| against the entries in |