-
Notifications
You must be signed in to change notification settings - Fork 927
/
Copy pathcontent-browser-media-cdm_registry_impl.cc.patch
40 lines (37 loc) · 1.74 KB
/
content-browser-media-cdm_registry_impl.cc.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
diff --git a/content/browser/media/cdm_registry_impl.cc b/content/browser/media/cdm_registry_impl.cc
index 81936b7601aa72effc5f99a188da72f8b9469568..6886a4e834b0e51f85348758d3eadeac2846d741 100644
--- a/content/browser/media/cdm_registry_impl.cc
+++ b/content/browser/media/cdm_registry_impl.cc
@@ -9,6 +9,10 @@
#include "content/public/common/cdm_info.h"
#include "content/public/common/content_client.h"
+#if defined(BRAVE_CHROMIUM_BUILD) && defined(OS_LINUX)
+#include <algorithm>
+#endif
+
namespace content {
// static
@@ -29,6 +33,24 @@ CdmRegistryImpl::~CdmRegistryImpl() {}
void CdmRegistryImpl::Init() {
// Let embedders register CDMs.
GetContentClient()->AddContentDecryptionModules(&cdms_, nullptr);
+#if defined(BRAVE_CHROMIUM_BUILD) && defined(OS_LINUX)
+ // On linux, we want to register widevine cdm to CdmRegistry when users opt
+ // in. Otherwise, widevine is initialized by default w/o user accept.
+ // So, widevine cdm is erased from |cdms_| and it is registered when users opt
+ // in. Also, we try to register it during the startup in
+ // BraveBrowserMainExtraParts::PreMainMessageLoopRun() by checking opted in
+ // prefs.
+ cdms_.erase(
+ std::remove_if(cdms_.begin(), cdms_.end(), [](const CdmInfo& info) {
+ // It would be better to use |kWidevineKeySystem| constant instead of
+ // using "com.widevine.alpha". To use constant, it requires adding
+ // widevine dependency to content module.
+ // However, using this string directly seems fine because it would not
+ // be changed and can avoid additional patching for this.
+ return info.supported_key_system == "com.widevine.alpha";
+ }),
+ cdms_.end());
+#endif
}
void CdmRegistryImpl::RegisterCdm(const CdmInfo& info) {