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

Side by Side Diff: media/base/key_systems.cc

Issue 1910283003: EME: Check for invalid Key System names on addition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Slightly improve comment Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 function above.
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698