ungoogled-software / ungoogled-chromium-fedora

RPM build for ungoogled-chromium
BSD 3-Clause "New" or "Revised" License
34 stars 6 forks source link

Widevine support #16

Open rkfox opened 2 years ago

rkfox commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

rkfox commented 2 years ago

Does not appear to be working after a browser restart.

rkfox commented 2 years ago

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

wchen342 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

rkfox commented 2 years ago

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

rkfox commented 2 years ago
+ 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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Same error after clearing out the old files.

wchen342 commented 2 years ago

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

rkfox commented 2 years ago
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 commented 2 years ago

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

rkfox commented 2 years ago

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 commented 2 years ago
[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 commented 2 years ago

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

rkfox commented 2 years ago

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 commented 2 years ago

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

marcinzelent commented 2 years ago

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.