Conversation
|
When widevine cdm is bundled, widevine cdm library is loaded into zygote process and To handle this, I tried to get If we also want to show content settings bubble in linux, I need to find how to prevent cdm initialization. Or if we can disable content bubble in linux, only first & second commits in this PR are needed. |
|
@simonhong This way, if any of user profiles has this preference enabled, we can somehow persist the fact that the binary should be loaded (e.g. create a marker file) and, for example, check it in |
|
With bundling, cdm loading and initialization is in separated phase. @iefremov As you said, we can't avoid loading. But, I thought we can control cdm service launching. However, I met multi profile issue and accessing profile_manager from io thread. So, I also want to know we should have same UX. If not, it can be achieved with simple patch. Only first & second commits are needed as I said earlier. IMO, current content setting bubble is not suitable because cdm library is already installed and loaded into process. It is just not initialized. |
|
With the 4th commit, widevine is only initialized after users allowed to use widevine via content settings bubble. |
c54c5f2 to
67b1a9f
Compare
|
I think this PR is ready to review. |
|
@bbondy Due to the restriction of zygote in linux, I enabled widevine by bundling. |
| void BraveBrowserMainExtraParts::PreMainMessageLoopRun() { | ||
| brave::AutoImportMuon(); | ||
| #if BUILDFLAG(BUNDLE_WIDEVINE_CDM) | ||
| RegisterWidevineCdmToCdmRegistry(); |
There was a problem hiding this comment.
rename -> MaybeRegister... ?
There was a problem hiding this comment.
And also skip ToCdmRegistry, sounds obvious :)
There was a problem hiding this comment.
Thanks. it's more clear 👍
| #include "third_party/widevine/cdm/buildflags.h" | ||
|
|
||
| #if BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT) | ||
| // On Windows and MacOS, widevine is supported by component updater. |
There was a problem hiding this comment.
Not sure if the comment is relevant here, maybe move it to the widevine.gni patch?
There was a problem hiding this comment.
Yep, widevine.gni is better place for this comment.
Done.
| void CdmRegistryImpl::Init() { | ||
| + // In linux, we want to register widevine cdm to CdmRegistry when users opted | ||
| + // in. If not, widevine is initialized by default. | ||
| + // Instead, we tries to register it in |
There was a problem hiding this comment.
I'm not a native speaker, but probably it should be "on linux", "when users opt in", "if not" -> otherwise, "we tries" -> "we try"
| + // Instead, we tries to register it in | ||
| + // BraveBrowserMainExtraParts::PreMainMessageLoopRun() by checking opted in | ||
| + // prefs. | ||
| +#if defined(BRAVE_CHROMIUM_BUILD) && !defined(OS_LINUX) |
There was a problem hiding this comment.
ENABLE_WIDEVINE_CDM_COMPONENT instead of !OS_LINUX ?
nevermind
There was a problem hiding this comment.
I'm wondering whether we potentially block CDMs other than Widevine on Linux?
There was a problem hiding this comment.
good catch.
Actually, widevine alone is used for now but don't know in the future whether chrome registers more cdms.
So, fixed to exclude widevine only after getting cdms list.
|
Generally LGTM with small nits |
|
Created f/u issue - brave/brave-browser#3172 |
e7b50fe to
481dc08
Compare
There was a problem hiding this comment.
Was this change announced somewhere? A think, if it was then we should fix all sources at once, otherwise its better to fix the linter. @bbondy could you please clarify?
There was a problem hiding this comment.
@iefremov it is enforced by the linter. There was a discussion in #brave-core
There was a problem hiding this comment.
@bridiver maybe we can fix the whole codebase by a single PR then? I can do one
There was a problem hiding this comment.
Mind placing a follow-up issue number here?
There was a problem hiding this comment.
has this been vetted by @bbondy? We're specifically prohibited from bundling on other platforms
There was a problem hiding this comment.
Yes, I discussed in dm and he agreed to do it as a next step. (long term)
There was a problem hiding this comment.
in gtest macroses expected argument is the first, i.e. EXPECT_EQ(0u, cdms.size());
There was a problem hiding this comment.
This erasure happens only on Linux
481dc08 to
c164607
Compare
simonhong
left a comment
There was a problem hiding this comment.
All done. PTAL.
Also this one - brave/brave-browser#3037
There was a problem hiding this comment.
please do not add comments to patches. We want to minimize the size of patches
There was a problem hiding this comment.
this patch file was deleted by overriding.
There was a problem hiding this comment.
I don't understand why we're patching this?
There was a problem hiding this comment.
W/o this patch in this file, reloading doesn't enable widevine after user accepts.
There was a problem hiding this comment.
I don't understand why we're doing this here, why wouldn't we do it in AddContentDecryptionModules where we don't have to patch anything?
There was a problem hiding this comment.
It seems my reply was deleted after force push.
There are some places where original cmd list is needed like PreloadLibraryCdms().
So, we can't override ChromeContentClient::AddContentDecryptionModules().
Also, this patch is removed by file overriding.
There was a problem hiding this comment.
this seems very fragile to me. Where did this list of codecs come from?
There was a problem hiding this comment.
Yes, I think so. I copied this logic from IsWidevineAvailable() in chrome_content_client.cc.
There was a problem hiding this comment.
Ah,, I think this can be improved by storing excluded cdminfo in CdmRegistry in at some place and can be reused again.
There was a problem hiding this comment.
All this log is deleted and used cached info from CdmRegistryImpl.
There was a problem hiding this comment.
All duplicated code is deleted by caching CdmInfo that created by upstream.
81ca1a1
There was a problem hiding this comment.
I think you're missing what I was trying to say here. It calls GetContentClient()->AddContentDecryptionModules and we can implement AddContentDecryptionModules in BraveContentClient
There was a problem hiding this comment.
I thought that first.
But, other places needs original list like PreloadLibraryCdms() in content_main_runner_impl.cc.
There was a problem hiding this comment.
I don't understand, the result would be identical because it passes a reference that can be modified
There was a problem hiding this comment.
ChromeContentClient::AddContentDecryptionModules() fills cdms to passed pointer.
Caller of above method will have different instance.
Of course, client of CdmRegistry will see same list.
There was a problem hiding this comment.
Oh, many comments were deleted..
Caller of AddContentDecryptionMoudles maintains it's own cmd list.
Clients of CdmRegistry see same list because CdmRegistry::GetAllRegisteredCdms() returns list reference.
There was a problem hiding this comment.
* is always preferable to & because it's more clear to the caller that you're passing something which might be modified when the method returns. If you're looking at a caller using ref, it's indistinguishable from passing by const ref or value unless you look at the method sig
There was a problem hiding this comment.
Yes, totally agree about that.
There was a problem hiding this comment.
basically, this rule is fixed in CC, so we don't even need to have comments like this in the codebase :)
There was a problem hiding this comment.
Right. using like this is natural in chromium project :) Removed.
0b8a725 to
15bcb7c
Compare
In linux, WidevineCdm library is bundled instead of installing it by component updating during the runtime. In linux, we can't load cdm library during the runtime because processes except browser process are forked from zygote process not created from brave.exe. So, cdm should be loaded(not initialized) into zygote process space before zygote enters the sandbox. Chrome browser also uses bundling for linux.
In linux, widevine should be enabled only when user accpeted.
With this, widevine cdm is initialized when users allowed to use widevine cdm via content settings bubble.
In linux, bundled widevine cdm is loaded by default but not initialized by default. It is only initialized when user allows it. Then, widevine cdm is added to CdmRegistry. That means renderer should also update supported KeySystems during the runtime.
We only want to exclude widevine. So, exclude it explicitly from list.
This test checks CdmRegistryImpl erases widevine from cdm list after fetching cdm list from content client. This erase only happened on linux.
Instead, use cached CdmInfo from CdmRegistryImpl.
15bcb7c to
81ca1a1
Compare
|
New PR (#1606) is opened for this. |
In linux, WidevineCdm library is bundled instead of installing it
by component updating during the runtime. In linux, we can't load
cdm library during the runtime because processes except browser
process are forked from zygote process not created from brave.exe.
So, cdm should be loaded(not initialized) into zygote process space
before zygote enters the sandbox.
Chrome browser also uses bundling for linux.
This PR should be merged with brave/brave-browser#3037
Fix brave/brave-browser#413
Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests) ongit rebase master(if needed).git rebase -ito squash commits (if needed).Test Plan:
yarn test brave_unittest --filter=CdmRegistryImplTest.WidevineCdmExcludeTestReviewer Checklist: