Chromium Code Reviews| Index: content/renderer/media/webcontentdecryptionmodulesession_impl.cc |
| diff --git a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc |
| index 65975186a5f7185310f928fec0ef84dfc9331d61..acd76d971d78857806e6e8379eeec90ffb40e272 100644 |
| --- a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc |
| +++ b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc |
| @@ -85,22 +85,24 @@ void WebContentDecryptionModuleSessionImpl::initializeNewSession( |
| const blink::WebString& init_data_type, |
| const uint8* init_data, |
| size_t init_data_length) { |
| - // TODO(ddorwin): Guard against this in supported types check and remove this. |
| - // Chromium only supports ASCII MIME types. |
| - if (!base::IsStringASCII(init_data_type)) { |
| - NOTREACHED(); |
| - OnSessionError(media::MediaKeys::NOT_SUPPORTED_ERROR, |
| - 0, |
| - "The initialization data type " + init_data_type.utf8() + |
| - " is not supported by the key system."); |
| - return; |
| - } |
| + DCHECK(base::IsStringASCII(init_data_type)); |
| std::string init_data_type_as_ascii = base::UTF16ToASCII(init_data_type); |
| DLOG_IF(WARNING, init_data_type_as_ascii.find('/') != std::string::npos) |
| << "init_data_type '" << init_data_type_as_ascii |
| << "' may be a MIME type"; |
| + // Attempt to translate content types. |
| + // TODO(sandersd): Remove once tests stop using content types. |
| + // http://crbug.com/385874 |
| + if (init_data_type_as_ascii == "audio/mp4" || |
|
ddorwin
2014/08/13 22:26:59
You need to call something like ToLowerCase().
sandersd (OOO until July 31)
2014/08/13 22:34:43
Done.
|
| + init_data_type_as_ascii == "video/mp4") { |
| + init_data_type_as_ascii = "cenc"; |
| + } else if (init_data_type_as_ascii == "audio/webm" || |
| + init_data_type_as_ascii == "video/webm") { |
| + init_data_type_as_ascii = "webm"; |
| + } |
| + |
| scoped_ptr<media::NewSessionCdmPromise> promise( |
| new media::NewSessionCdmPromise( |
| base::Bind(&WebContentDecryptionModuleSessionImpl::SessionCreated, |