Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widevine support #16

Open
rkfox opened this issue Oct 12, 2021 · 25 comments
Open

Widevine support #16

rkfox opened this issue Oct 12, 2021 · 25 comments

Comments

@rkfox
Copy link

rkfox commented Oct 12, 2021

Is there a way to enable Widevine DRM in freeworld builds? I installed Widevine with the scripts in chromium-widevine but DRM is not enabled.

@wchen342
Copy link
Collaborator

wchen342 commented Oct 12, 2021

I have never dealt with widevine before so I am not entirely sure here. There are several things I can think of:

  1. The patches in the spec file disable internal binary Widevine download and instead load the library from either $HOME/.local/lib/libwidevinecdm.so or /opt/google/chrome/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so. From what I read in the scripts from chromium-widevine, ./use-from-google-chrome.sh needs to find a chromium installation (which won't happen because the executable name is not chromium for ungoogled-chromium). In the case you are using ./use-standalone-widevine.sh it shall work, unless somehow the folder got deleted. Can you check whether the path /opt/google/chrome/WidevineCdm/_platform_specific/linux_x64 exists?

  2. Which website are you trying to view? Some websites are known to be not working on Linux like Amazon because the level of DRM is different.

@rkfox
Copy link
Author

rkfox commented Oct 13, 2021

I did verify that the library was in the correct location /usr/lib64/ungoogled-chromium/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so. I had to modify the scripts a bit to work with ungoogled-chromium folder names. I'm not sure if I need to build with the Widevine library in $HOME/.local/lib instead of copying it into the chromium directory afterward?

There is an HTML file included that tests if DRM is enabled as well as many websites like this one that test DRM. These tests also show that all/most of the relevant codecs are not supported by the browser.

[✗] Widevine not found
[✗] audio codec audio/mp4;codecs="mp4a.40.2" not supported
[✗] video codec video/mp2t;codecs="avc1.42E01E,mp4a.40.2" not supported
[✗] video codec video/webm;codecs="vorbis,vp8" not supported
[✗] video codec video/mp4;codecs="ec-3" not supported
[✗] video codec video/mp4;codecs="avc1.42c00d" not supported

I do not have a /opt/google folder.

I also have Allow sites to play protected content enabled.

@wchen342
Copy link
Collaborator

Can you try creating /opt/google/chrome/WidevineCdm/_platform_specific/linux_x64 and copy libwidevinecdm.so there?

@rkfox
Copy link
Author

rkfox commented Oct 13, 2021

Does not appear to be working after a browser restart.

@rkfox
Copy link
Author

rkfox commented Oct 13, 2021

Widevine does not appear in chrome://components/.

@wchen342
Copy link
Collaborator

The codecs doesn't look right from your previous post, at least webm/vp8 shall work. It works on my non-freeworld version.
I tested on freeworld version I built myself, the test page gave me

Media Source Extension – MSE
MSE is supported by your current browser.

[x] video/mp4; codecs="avc1.42c00d"
[ ] video/mp4; codecs="ec-3"
[x] video/webm; codecs="vorbis,vp8"
[x] video/mp2t; codecs="avc1.42E01E,mp4a.40.2"

Although this seems to be unrelated to the widevine problem.

@wchen342
Copy link
Collaborator

wchen342 commented Oct 13, 2021

If you don't mind chromium download Widevine binary itself, then try comment out Patch7, Patch79 as well as line 1242 in the spec file and recompile.

EDIT: actually I think probably the way Patch79 is done, it prevents the widevine components from loading completely. I cannot verify it right now but it is worth trying.

@rkfox
Copy link
Author

rkfox commented Oct 13, 2021

I can try building with those patches disabled. I'm not sure what you mean by downloading the Widevine binary; I already have it installed in /opt/google and /usr/lib64/ungoogled-chromium.

@wchen342
Copy link
Collaborator

what you mean by downloading the Widevine binary

By disabling the patches then chromium is supposed to download the widevine library by itself in background if it cannot find the library.

@rkfox
Copy link
Author

rkfox commented Oct 13, 2021

It fails here:

+ third_party/woff2 third_party/wuffs third_party/x11proto third_party/xcbproto third_party/xdg-utils third_party/zxcvbn-cpp third_party/zlib third_party/zlib/google tools/gn/src/base/third_party/icu url/third_party/mozilla v8/src/third_party/siphash v8/src/third_party/utf8-decoder v8/src/third_party/valgrind v8/third_party/v8 v8/third_party/inspector_protocol --do-remove
/var/tmp/rpm-tmp.VE5ygS: line 503: third_party/woff2: Is a directory
error: Bad exit status from /var/tmp/rpm-tmp.VE5ygS (%prep)


RPM build errors:
    bogus date in %changelog: Thu Sep 28 2021 wchen342 <> - 94.0.4606.61-1
    Bad exit status from /var/tmp/rpm-tmp.VE5ygS (%prep)
build2.sh: line 82: mium.spec: command not found

@wchen342
Copy link
Collaborator

I think you deleted or missed a \ at the end of a line around third_party/woff2?

@rkfox
Copy link
Author

rkfox commented Oct 13, 2021

Yes, I commented out one of the paths in the list which was causing the error. I deleted line 1242 instead.

@rkfox
Copy link
Author

rkfox commented Oct 13, 2021

+ export 'NINJA_STATUS=[chrome:%f/%t] '
+ NINJA_STATUS='[chrome:%f/%t] '
+ ../depot_tools/ninja -j 4 -C out/Release chrome
ninja: Entering directory `out/Release'
ninja: error: '../../third_party/widevine/cdm/widevine_cdm_version.h', needed by 'gen/widevine_cdm_version.h', missing and no known rule to make it
error: Bad exit status from /var/tmp/rpm-tmp.FxmVol (%build)

@wchen342
Copy link
Collaborator

Did you re-extract the files from chromium source? Can you check whether the file is there? It shall be in the source and if you removed that line it shall be kept during prepare.

@rkfox
Copy link
Author

rkfox commented Oct 13, 2021

No results from running find BUILD/ -name libwidevinecdm.so. Although I just realized I had the source downloads cached. I don't think it should matter though?

@rkfox
Copy link
Author

rkfox commented Oct 13, 2021

Same error after clearing out the old files.

@wchen342
Copy link
Collaborator

Sorry I made a mistake. You shouldn't delete line 1242.

@rkfox
Copy link
Author

rkfox commented Oct 14, 2021

In file included from ../../content/browser/hid/hid_service.cc:15:
../../content/browser/web_contents/web_contents_impl.h:175:22: warning: 'content::WebContentsImpl' has a field 'content::WebContentsImpl::javascript_dialog_dismiss_notifier_' whose type uses the anonymous namespace [-Wsubobject-linkage]
  175 | class CONTENT_EXPORT WebContentsImpl : public WebContents,
      |                      ^~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
error: Bad exit status from /var/tmp/rpm-tmp.4ObE8W (%build)

@wchen342
Copy link
Collaborator

That one is not the real error. Can you paste the whole log somewhere? There shall be another error before this message.

@rkfox
Copy link
Author

rkfox commented Oct 14, 2021

It looks like the program was interrupted externally. I think I may have ran out of memory. I'll try again with less threads.

@rkfox
Copy link
Author

rkfox commented Oct 17, 2021

[chrome:49899/49899] LINK ./chrome
FAILED: chrome 
/usr/bin/python3 "../../build/toolchain/gcc_link_wrapper.py" --output="./chrome" -- g++ -Wl,--version-script=../../build/linux/chrome.map -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -m64 -Wl,-O2 -Wl,--gc-sections -rdynamic -Wl,-z,defs -Wl,--as-needed -pie -Wl,--disable-new-dtags -o "./chrome" -Wl,--start-group @"./chrome.rsp"  -Wl,--end-group  -latomic -ldl -lpthread -lrt -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lcups -ldrm -lfontconfig -ldbus-1 -lz -lresolv -lpng16 -lwebpdemux -lwebpmux -lwebp -ljpeg -lexpat -lxcb -lxkbcommon -lm -lX11 -lXcomposite -lXdamage -lXext -lXfixes -lXrender -lXrandr -lXtst -lpipewire-0.3 -lgbm -lwayland-client -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lcairo -lXi -lpci -lasound -lFLAC -lminizip -lgmodule-2.0 -lgthread-2.0 -lgtk-3 -lgdk-3 -latk-1.0 -lcairo-gobject -lgdk_pixbuf-2.0 -lxshmfence -lxslt -lxml2
/usr/bin/ld: obj/chrome/browser/browser/download_target_determiner.o: in function `DownloadTargetDeterminer::CheckVisitedReferrerBeforeDone(bool)':
download_target_determiner.cc:(.text._ZN24DownloadTargetDeterminer30CheckVisitedReferrerBeforeDoneEb+0x3d): undefined reference to `safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile(Profile*)'
/usr/bin/ld: download_target_determiner.cc:(.text._ZN24DownloadTargetDeterminer30CheckVisitedReferrerBeforeDoneEb+0x77): undefined reference to `safe_browsing::FileTypePolicies::GetInstance()'
/usr/bin/ld: download_target_determiner.cc:(.text._ZN24DownloadTargetDeterminer30CheckVisitedReferrerBeforeDoneEb+0x94): undefined reference to `safe_browsing::FileTypePolicies::GetFileDangerLevel(base::FilePath const&) const'
/usr/bin/ld: download_target_determiner.cc:(.text._ZN24DownloadTargetDeterminer30CheckVisitedReferrerBeforeDoneEb+0xac): undefined reference to `safe_browsing::RecordDownloadFileTypeAttributes(safe_browsing::DownloadFileType_DangerLevel, bool, bool, absl::optional<base::Time>)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
error: Bad exit status from /var/tmp/rpm-tmp.HkrB4T (%build)

@wchen342
Copy link
Collaborator

Are you using the new spec file? I think is_official_build=true is not in GN flags.

@rkfox
Copy link
Author

rkfox commented Oct 20, 2021

Yes that is from using the new spec file. (I had to update the chromium sources to match.) %global official_build 1 is set in the SPEC file which looks like it sets is_official_build=true further down.

@wchen342
Copy link
Collaborator

That's weird. Maybe just try to comment out safe_browsing:: stuff in download_target_determiner.cc.

@marcinzelent
Copy link

To anyone having the same issue, I managed to get version 98.0.4758.80 working based on this discussion. I followed the README instructions, changed global freeworld to 1, commented out patch 79, built it, installed the package, and copied WidevineCdm from official Google Chrome deb package to /usr/lib64/ungoogled-chromium. In chrome://components, Widevine Content Decryption Module is listed with version 4.10.2391.0. Bitmovin DRM test detects Widevine, Spotify works too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants