Index: content/renderer/renderer_webkitplatformsupport_impl.cc |
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc |
index 5e74dc4557e40d43fae9fa619c4c936dce33152e..2b1da6c08af4c50d02a2f936d6d8d2be1d779877 100644 |
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc |
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc |
@@ -41,6 +41,8 @@ |
#include "ipc/ipc_sync_message_filter.h" |
#include "media/audio/audio_output_device.h" |
#include "media/base/audio_hardware_config.h" |
+#include "media/filters/stream_parser_factory.h" |
+#include "net/base/mime_util.h" |
#include "net/base/net_util.h" |
#include "third_party/WebKit/public/web/WebFrame.h" |
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
@@ -94,6 +96,7 @@ using WebKit::WebIDBFactory; |
using WebKit::Platform; |
using WebKit::WebMediaStreamCenter; |
using WebKit::WebMediaStreamCenterClient; |
+using WebKit::WebMimeRegistry; |
using WebKit::WebRTCPeerConnectionHandler; |
using WebKit::WebRTCPeerConnectionHandlerClient; |
using WebKit::WebStorageNamespace; |
@@ -112,10 +115,17 @@ base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = |
class RendererWebKitPlatformSupportImpl::MimeRegistry |
: public webkit_glue::SimpleWebMimeRegistryImpl { |
public: |
- virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&); |
- virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); |
+ virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType( |
scherkus (not reviewing)
2013/06/21 02:44:06
ddorwin: FYI
ddorwin
2013/06/21 02:58:19
You removed the wrong one. The three-parameter one
scherkus (not reviewing)
2013/06/21 17:02:16
Looks like I can't remove it yet. Requires a Blink
|
+ const WebKit::WebString& mime_type, |
+ const WebKit::WebString& codecs); |
+ virtual bool supportsMediaSourceMIMEType(const WebKit::WebString& mime_type, |
+ const WebKit::WebString& codecs); |
+ virtual WebKit::WebString mimeTypeForExtension( |
+ const WebKit::WebString& file_extension); |
+ virtual WebKit::WebString mimeTypeFromFile( |
+ const WebKit::WebString& file_path); |
virtual WebKit::WebString preferredExtensionForMIMEType( |
- const WebKit::WebString&); |
+ const WebKit::WebString& mime_type); |
}; |
class RendererWebKitPlatformSupportImpl::FileUtilities |
@@ -223,10 +233,6 @@ WebKit::WebClipboard* RendererWebKitPlatformSupportImpl::clipboard() { |
} |
WebKit::WebMimeRegistry* RendererWebKitPlatformSupportImpl::mimeRegistry() { |
- WebKit::WebMimeRegistry* mime_registry = |
- GetContentClient()->renderer()->OverrideWebMimeRegistry(); |
- if (mime_registry) |
- return mime_registry; |
return mime_registry_.get(); |
} |
@@ -380,6 +386,54 @@ WebFileSystem* RendererWebKitPlatformSupportImpl::fileSystem() { |
//------------------------------------------------------------------------------ |
+WebMimeRegistry::SupportsType |
+RendererWebKitPlatformSupportImpl::MimeRegistry::supportsMediaMIMEType( |
+ const WebString& mime_type, |
+ const WebString& codecs) { |
+ const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); |
+ // Not supporting the container is a flat-out no. |
+ if (!net::IsSupportedMediaMimeType(mime_type_ascii)) |
+ return IsNotSupported; |
+ |
ddorwin
2013/06/21 02:58:19
Restore the code you removed above to pass your te
scherkus (not reviewing)
2013/06/21 17:02:16
Done.
|
+ // Check list of strict codecs to see if it is supported. |
+ if (net::IsStrictMediaMimeType(mime_type_ascii)) { |
+ // We support the container, but no codecs were specified. |
+ if (codecs.isNull()) |
+ return MayBeSupported; |
+ |
+ // Check if the codecs are a perfect match. |
+ std::vector<std::string> strict_codecs; |
+ net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); |
+ if (!net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)) |
+ return IsNotSupported; |
+ |
+ // Good to go! |
+ return IsSupported; |
+ } |
+ |
+ // If we don't recognize the codec, it's possible we support it. |
+ std::vector<std::string> parsed_codecs; |
+ net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); |
+ if (!net::AreSupportedMediaCodecs(parsed_codecs)) |
+ return MayBeSupported; |
+ |
+ // Otherwise we have a perfect match. |
+ return IsSupported; |
+} |
+ |
+bool |
+RendererWebKitPlatformSupportImpl::MimeRegistry::supportsMediaSourceMIMEType( |
+ const WebKit::WebString& mime_type, |
+ const WebString& codecs) { |
+ const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); |
+ std::vector<std::string> parsed_codec_ids; |
+ net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false); |
+ if (mime_type_ascii.empty() || parsed_codec_ids.size() == 0) |
+ return false; |
+ return media::StreamParserFactory::IsTypeSupported( |
+ mime_type_ascii, parsed_codec_ids); |
+} |
+ |
WebString |
RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeForExtension( |
const WebString& file_extension) { |