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

Unified Diff: net/base/mime_util.cc

Issue 400023002: Fix canPlayType() support for non-RFC compliant mp3 mimetype. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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') | no next file » | 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 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
« no previous file with comments | « content/browser/media/media_canplaytype_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698