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

Unified Diff: content/renderer/media_recorder/media_recorder_handler.cc

Issue 2805553004: Wire up MediaCapabilities is_supported to MimeUtil (Closed)
Patch Set: Remove test for theora - not supported on android Created 3 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_capabilities_browsertest.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media_recorder/media_recorder_handler.cc
diff --git a/content/renderer/media_recorder/media_recorder_handler.cc b/content/renderer/media_recorder/media_recorder_handler.cc
index 544665f530f4367af01c1fe71b13795221baed12..7943bab94b229f8c696d1c1c7f9dbacf73b127b8 100644
--- a/content/renderer/media_recorder/media_recorder_handler.cc
+++ b/content/renderer/media_recorder/media_recorder_handler.cc
@@ -292,33 +292,19 @@ void MediaRecorderHandler::EncodingInfo(
// TODO(mcasas): Support the case when both video and audio configurations are
// specified: https://crbug.com/709181.
- std::string content_type;
- if (configuration.video_configuration)
- content_type = configuration.video_configuration->content_type.Ascii();
- else
- content_type = configuration.audio_configuration->content_type.Ascii();
-
- // |content_type| should be of the form "bla;codecs=foo", where "bla" is the
- // type and "codecs=foo" is the parameter ("foo" is the parameter value), see
- // RFC 2231 [1]. CanSupportMimeType() operates on type and parameter value.
- // [1] https://tools.ietf.org/html/rfc2231
- base::StringTokenizer mime_tokenizer(content_type, ";");
- blink::WebString web_type;
- blink::WebString web_codecs;
- if (mime_tokenizer.GetNext())
- web_type = blink::WebString::FromASCII(mime_tokenizer.token());
- if (mime_tokenizer.GetNext()) {
- const std::string parameters = mime_tokenizer.token();
- base::StringTokenizer parameter_tokenizer(parameters, "=");
- if (parameter_tokenizer.GetNext() &&
- base::ToLowerASCII(parameter_tokenizer.token()) == "codecs" &&
- parameter_tokenizer.GetNext()) {
- web_codecs = blink::WebString::FromASCII(parameter_tokenizer.token());
- }
+ blink::WebString mime_type;
+ blink::WebString codec;
+ if (configuration.video_configuration) {
+ mime_type = configuration.video_configuration->mime_type;
+ codec = configuration.video_configuration->codec;
+ } else {
+ mime_type = configuration.audio_configuration->mime_type;
+ codec = configuration.audio_configuration->codec;
}
- info->supported = CanSupportMimeType(web_type, web_codecs);
- DVLOG(1) << "type: " << web_type.Ascii() << ", params:" << web_codecs.Ascii()
+ // See RFC 2231. https://tools.ietf.org/html/rfc2231
+ info->supported = CanSupportMimeType(mime_type, codec);
+ DVLOG(1) << "type: " << mime_type.Ascii() << ", codec:" << codec.Ascii()
<< " is" << (info->supported ? " supported" : " NOT supported");
scoped_callbacks.PassCallbacks()->OnSuccess(std::move(info));
« no previous file with comments | « content/browser/media/media_capabilities_browsertest.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698