Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/base/key_systems.h" | 5 #include "media/base/key_systems.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 if (IsExternalClearKey(key_system)) | 159 if (IsExternalClearKey(key_system)) |
| 160 return true; | 160 return true; |
| 161 | 161 |
| 162 // Chromecast defines behaviors for Cast clients within its reverse domain. | 162 // Chromecast defines behaviors for Cast clients within its reverse domain. |
| 163 const char kChromecastRoot[] = "com.chromecast"; | 163 const char kChromecastRoot[] = "com.chromecast"; |
| 164 if (IsChildKeySystemOf(key_system, kChromecastRoot)) | 164 if (IsChildKeySystemOf(key_system, kChromecastRoot)) |
| 165 return true; | 165 return true; |
| 166 | 166 |
| 167 // Implementations that do not have a specification or appropriate glue code | 167 // Implementations that do not have a specification or appropriate glue code |
| 168 // can use the "x-" prefix to avoid conflicting with and advertising support | 168 // can use the "x-" prefix to avoid conflicting with and advertising support |
| 169 // for real key system names. Use is discouraged. | 169 // for real key system names. Use is discouraged. |
|
xhwang
2016/05/20 17:10:14
OOC, where do we use this?
ddorwin
2016/05/20 17:19:27
Platform key systems on Android TV.
xhwang
2016/05/20 17:22:31
Acknowledged.
| |
| 170 const char kExcludedPrefix[] = "x-"; | 170 const char kExcludedPrefix[] = "x-"; |
| 171 if (key_system.find(kExcludedPrefix, 0, arraysize(kExcludedPrefix) - 1) == 0) | 171 if (key_system.find(kExcludedPrefix, 0, arraysize(kExcludedPrefix) - 1) == 0) |
| 172 return true; | 172 return true; |
| 173 | 173 |
| 174 return false; | 174 return false; |
| 175 } | 175 } |
| 176 | 176 |
| 177 class KeySystemsImpl : public KeySystems { | 177 class KeySystemsImpl : public KeySystems { |
| 178 public: | 178 public: |
| 179 static KeySystemsImpl* GetInstance(); | 179 static KeySystemsImpl* GetInstance(); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 DCHECK(!properties->GetKeySystemName().empty()); | 370 DCHECK(!properties->GetKeySystemName().empty()); |
| 371 DCHECK(properties->GetPersistentLicenseSessionSupport() != | 371 DCHECK(properties->GetPersistentLicenseSessionSupport() != |
| 372 EmeSessionTypeSupport::INVALID); | 372 EmeSessionTypeSupport::INVALID); |
| 373 DCHECK(properties->GetPersistentReleaseMessageSessionSupport() != | 373 DCHECK(properties->GetPersistentReleaseMessageSessionSupport() != |
| 374 EmeSessionTypeSupport::INVALID); | 374 EmeSessionTypeSupport::INVALID); |
| 375 DCHECK(properties->GetPersistentStateSupport() != | 375 DCHECK(properties->GetPersistentStateSupport() != |
| 376 EmeFeatureSupport::INVALID); | 376 EmeFeatureSupport::INVALID); |
| 377 DCHECK(properties->GetDistinctiveIdentifierSupport() != | 377 DCHECK(properties->GetDistinctiveIdentifierSupport() != |
| 378 EmeFeatureSupport::INVALID); | 378 EmeFeatureSupport::INVALID); |
| 379 | 379 |
| 380 if (!IsPotentiallySupportedKeySystem(properties->GetKeySystemName())) { | |
| 381 // If you encounter this path, see the comments for the above function. | |
|
xhwang
2016/05/20 17:10:14
nit: which above function?
ddorwin
2016/05/20 17:19:27
The one in the if statement. Is there a better way
xhwang
2016/05/20 17:22:31
I see. When I see "above function" I was looking a
ddorwin
2016/05/20 22:47:20
I improved it a tiny bit.
| |
| 382 DLOG(ERROR) << "Unsupported name '" << properties->GetKeySystemName() | |
| 383 << "'. See code comments."; | |
| 384 continue; | |
| 385 } | |
| 386 | |
| 380 // Supporting persistent state is a prerequsite for supporting persistent | 387 // Supporting persistent state is a prerequsite for supporting persistent |
| 381 // sessions. | 388 // sessions. |
| 382 if (properties->GetPersistentStateSupport() == | 389 if (properties->GetPersistentStateSupport() == |
| 383 EmeFeatureSupport::NOT_SUPPORTED) { | 390 EmeFeatureSupport::NOT_SUPPORTED) { |
| 384 DCHECK(properties->GetPersistentLicenseSessionSupport() == | 391 DCHECK(properties->GetPersistentLicenseSessionSupport() == |
| 385 EmeSessionTypeSupport::NOT_SUPPORTED); | 392 EmeSessionTypeSupport::NOT_SUPPORTED); |
| 386 DCHECK(properties->GetPersistentReleaseMessageSessionSupport() == | 393 DCHECK(properties->GetPersistentReleaseMessageSessionSupport() == |
| 387 EmeSessionTypeSupport::NOT_SUPPORTED); | 394 EmeSessionTypeSupport::NOT_SUPPORTED); |
| 388 } | 395 } |
| 389 | 396 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 uint32_t codecs_mask) { | 547 uint32_t codecs_mask) { |
| 541 RegisterMimeType(mime_type, static_cast<EmeCodec>(codecs_mask)); | 548 RegisterMimeType(mime_type, static_cast<EmeCodec>(codecs_mask)); |
| 542 } | 549 } |
| 543 | 550 |
| 544 bool KeySystemsImpl::IsSupportedKeySystem(const std::string& key_system) const { | 551 bool KeySystemsImpl::IsSupportedKeySystem(const std::string& key_system) const { |
| 545 DCHECK(thread_checker_.CalledOnValidThread()); | 552 DCHECK(thread_checker_.CalledOnValidThread()); |
| 546 | 553 |
| 547 if (!key_system_properties_map_.count(key_system)) | 554 if (!key_system_properties_map_.count(key_system)) |
| 548 return false; | 555 return false; |
| 549 | 556 |
| 550 // TODO(ddorwin): Move this to where we add key systems when prefixed EME is | |
| 551 // removed (crbug.com/249976). | |
| 552 if (!IsPotentiallySupportedKeySystem(key_system)) { | |
| 553 // If you encounter this path, see the comments for the above function. | |
| 554 DLOG(ERROR) << "Unrecognized key system " << key_system | |
| 555 << ". See code comments."; | |
| 556 return false; | |
| 557 } | |
| 558 | |
| 559 return true; | 557 return true; |
| 560 } | 558 } |
| 561 | 559 |
| 562 EmeConfigRule KeySystemsImpl::GetContentTypeConfigRule( | 560 EmeConfigRule KeySystemsImpl::GetContentTypeConfigRule( |
| 563 const std::string& key_system, | 561 const std::string& key_system, |
| 564 EmeMediaType media_type, | 562 EmeMediaType media_type, |
| 565 const std::string& container_mime_type, | 563 const std::string& container_mime_type, |
| 566 const std::vector<std::string>& codecs) const { | 564 const std::vector<std::string>& codecs) const { |
| 567 DCHECK(thread_checker_.CalledOnValidThread()); | 565 DCHECK(thread_checker_.CalledOnValidThread()); |
| 568 | 566 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 uint32_t mask) { | 728 uint32_t mask) { |
| 731 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); | 729 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); |
| 732 } | 730 } |
| 733 | 731 |
| 734 MEDIA_EXPORT void AddMimeTypeCodecMask(const std::string& mime_type, | 732 MEDIA_EXPORT void AddMimeTypeCodecMask(const std::string& mime_type, |
| 735 uint32_t mask) { | 733 uint32_t mask) { |
| 736 KeySystemsImpl::GetInstance()->AddMimeTypeCodecMask(mime_type, mask); | 734 KeySystemsImpl::GetInstance()->AddMimeTypeCodecMask(mime_type, mask); |
| 737 } | 735 } |
| 738 | 736 |
| 739 } // namespace media | 737 } // namespace media |
| OLD | NEW |