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

Side by Side Diff: components/cdm/renderer/widevine_key_systems.cc

Issue 923283002: Implement checks for distinctiveIdentifier and persistentState in requestMediaKeySystemAccess(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 5 years, 10 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
OLDNEW
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 "components/cdm/renderer/widevine_key_systems.h" 5 #include "components/cdm/renderer/widevine_key_systems.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "media/base/eme_constants.h" 11 #include "media/base/eme_constants.h"
12 12
13 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 13 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
14 14
15 #if defined(WIDEVINE_CDM_AVAILABLE) 15 #if defined(WIDEVINE_CDM_AVAILABLE)
16 16
17 using media::KeySystemInfo; 17 using media::KeySystemInfo;
18 using media::SupportedCodecs; 18 using media::SupportedCodecs;
19 19
20 namespace cdm { 20 namespace cdm {
21 21
22 // Return |name|'s parent key system. 22 // Return |name|'s parent key system.
23 static std::string GetDirectParentName(std::string name) { 23 static std::string GetDirectParentName(std::string name) {
24 size_t last_period = name.find_last_of('.'); 24 size_t last_period = name.find_last_of('.');
25 DCHECK_GT(last_period, 0u); 25 DCHECK_GT(last_period, 0u);
26 return name.substr(0u, last_period); 26 return name.substr(0u, last_period);
27 } 27 }
28 28
29 void AddWidevineWithCodecs(WidevineCdmType widevine_cdm_type, 29 void AddWidevineWithCodecs(
30 SupportedCodecs supported_codecs, 30 WidevineCdmType widevine_cdm_type,
31 std::vector<KeySystemInfo>* concrete_key_systems) { 31 SupportedCodecs supported_codecs,
32 KeySystemInfo info(kWidevineKeySystem); 32 media::EmeSessionTypeSupport persistent_license_support,
33 media::EmeSessionTypeSupport persistent_release_message_support,
34 media::EmeFeatureSupport persistent_state_support,
35 media::EmeFeatureSupport distinctive_identifier_support,
36 std::vector<KeySystemInfo>* concrete_key_systems) {
37 KeySystemInfo info;
38 info.key_system = kWidevineKeySystem;
33 39
34 switch (widevine_cdm_type) { 40 switch (widevine_cdm_type) {
35 case WIDEVINE: 41 case WIDEVINE:
36 // For standard Widevine, add parent name. 42 // For standard Widevine, add parent name.
37 info.parent_key_system = GetDirectParentName(kWidevineKeySystem); 43 info.parent_key_system = GetDirectParentName(kWidevineKeySystem);
38 break; 44 break;
39 #if defined(OS_ANDROID) 45 #if defined(OS_ANDROID)
40 case WIDEVINE_HR_NON_COMPOSITING: 46 case WIDEVINE_HR_NON_COMPOSITING:
41 info.key_system.append(".hrnoncompositing"); 47 info.key_system.append(".hrnoncompositing");
42 break; 48 break;
(...skipping 10 matching lines...) Expand all
53 // Here we assume that support for a container imples support for the 59 // Here we assume that support for a container imples support for the
54 // associated initialization data type. KeySystems handles validating 60 // associated initialization data type. KeySystems handles validating
55 // |init_data_type| x |container| pairings. 61 // |init_data_type| x |container| pairings.
56 if (supported_codecs & media::EME_CODEC_WEBM_ALL) 62 if (supported_codecs & media::EME_CODEC_WEBM_ALL)
57 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_WEBM; 63 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_WEBM;
58 #if defined(USE_PROPRIETARY_CODECS) 64 #if defined(USE_PROPRIETARY_CODECS)
59 if (supported_codecs & media::EME_CODEC_MP4_ALL) 65 if (supported_codecs & media::EME_CODEC_MP4_ALL)
60 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC; 66 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC;
61 #endif // defined(USE_PROPRIETARY_CODECS) 67 #endif // defined(USE_PROPRIETARY_CODECS)
62 68
69 info.persistent_license_support = persistent_license_support;
70 info.persistent_release_message_support = persistent_release_message_support;
71 info.persistent_state_support = persistent_state_support;
72 info.distinctive_identifier_support = distinctive_identifier_support;
73
63 #if defined(ENABLE_PEPPER_CDMS) 74 #if defined(ENABLE_PEPPER_CDMS)
64 info.pepper_type = kWidevineCdmPluginMimeType; 75 info.pepper_type = kWidevineCdmPluginMimeType;
65 #endif // defined(ENABLE_PEPPER_CDMS) 76 #endif // defined(ENABLE_PEPPER_CDMS)
66 77
67 concrete_key_systems->push_back(info); 78 concrete_key_systems->push_back(info);
68 } 79 }
69 80
70 } // namespace cdm 81 } // namespace cdm
71 82
72 #endif // defined(WIDEVINE_CDM_AVAILABLE) 83 #endif // defined(WIDEVINE_CDM_AVAILABLE)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698