Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/blink/key_system_config_selector.h" | 5 #include "media/blink/key_system_config_selector.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 } | 303 } |
| 304 | 304 |
| 305 // TODO(sandersd): Move contentType parsing from Blink to here so that invalid | 305 // TODO(sandersd): Move contentType parsing from Blink to here so that invalid |
| 306 // parameters can be rejected. http://crbug.com/417561 | 306 // parameters can be rejected. http://crbug.com/417561 |
| 307 bool KeySystemConfigSelector::IsSupportedContentType( | 307 bool KeySystemConfigSelector::IsSupportedContentType( |
| 308 const std::string& key_system, | 308 const std::string& key_system, |
| 309 EmeMediaType media_type, | 309 EmeMediaType media_type, |
| 310 const std::string& container_mime_type, | 310 const std::string& container_mime_type, |
| 311 const std::string& codecs, | 311 const std::string& codecs, |
| 312 KeySystemConfigSelector::ConfigState* config_state) { | 312 KeySystemConfigSelector::ConfigState* config_state) { |
| 313 // contentTypes must provide a codec string unless the container implies a | |
| 314 // particular codec. For EME, none of the currently supported containers | |
| 315 // imply a codec, so |codecs| must be provided. | |
| 316 if (codecs.empty()) { | |
| 317 // Since the spec didn't initially require this, add an exemption for | |
|
ddorwin
2016/04/25 22:58:51
If we want to exclude contentTypes without codecs
jrummell
2016/04/26 21:23:56
Acknowledged.
| |
| 318 // some existing containers to give clients time to adapt. | |
| 319 // TODO(jrummell): Remove this exemption once the number of contentTypes | |
| 320 // without codecs drops low enough (UMA added in the blink code). | |
| 321 // http://crbug.com/605661. | |
| 322 if (container_mime_type != "audio/webm" && | |
|
ddorwin
2016/04/25 22:58:51
This assumes the string is lower case, but that do
jrummell
2016/04/26 21:23:56
Done.
| |
| 323 container_mime_type != "video/webm" && | |
| 324 container_mime_type != "audio/mp4" && | |
| 325 container_mime_type != "video/mp4") { | |
| 326 return false; | |
| 327 } | |
| 328 } | |
| 329 | |
| 313 // Check that |container_mime_type| and |codecs| are supported by Chrome. This | 330 // Check that |container_mime_type| and |codecs| are supported by Chrome. This |
| 314 // is done primarily to validate extended codecs, but it also ensures that the | 331 // is done primarily to validate extended codecs, but it also ensures that the |
| 315 // CDM cannot support codecs that Chrome does not (which could complicate the | 332 // CDM cannot support codecs that Chrome does not (which could complicate the |
| 316 // robustness algorithm). | 333 // robustness algorithm). |
| 317 if (!IsSupportedMediaFormat(container_mime_type, codecs, | 334 if (!IsSupportedMediaFormat(container_mime_type, codecs, |
| 318 CanUseAesDecryptor(key_system))) { | 335 CanUseAesDecryptor(key_system))) { |
| 319 return false; | 336 return false; |
| 320 } | 337 } |
| 321 | 338 |
| 322 // TODO(servolk): Converting |container_mime_type| to lower-case could be | 339 // TODO(servolk): Converting |container_mime_type| to lower-case could be |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 803 | 820 |
| 804 void KeySystemConfigSelector::OnPermissionResult( | 821 void KeySystemConfigSelector::OnPermissionResult( |
| 805 scoped_ptr<SelectionRequest> request, | 822 scoped_ptr<SelectionRequest> request, |
| 806 bool is_permission_granted) { | 823 bool is_permission_granted) { |
| 807 request->was_permission_requested = true; | 824 request->was_permission_requested = true; |
| 808 request->is_permission_granted = is_permission_granted; | 825 request->is_permission_granted = is_permission_granted; |
| 809 SelectConfigInternal(std::move(request)); | 826 SelectConfigInternal(std::move(request)); |
| 810 } | 827 } |
| 811 | 828 |
| 812 } // namespace media | 829 } // namespace media |
| OLD | NEW |