# Chromium

This section describes the V-Nova LCEVC integration into Chromium.

**Note:** The Chromium build integrated with V-Nova LCEVC is a fork from the Chromium open source project. The integration is currently still in beta and is not aligned with all versions of the main project. Please contact us for more details if you are interested in deploying with your solution.

[Chromium ](https://www.chromium.org/)is a Google-maintained open-source browser project. LCEVC Chromium is a derived work by V-Nova Ltd, that adds support for playing back streams enhanced with MPEG-5 Part 2 LCEVC using HTML5 video elements, Media Source Extension or Encrypted Media Extensions.

The official project page is <https://www.chromium.org/>. which provides information about the project, design documents, getting the code, and build guides.

### Design Overview <a href="#toc86073198" id="toc86073198"></a>

Media playback in Chromium encompasses a large array of technologies, so by necessity, this will provide only a brief outline. Inside the Chromium source media/ directory resides the components for media demuxing, software and hardware video decode, audio output, as well as audio and video rendering. ([source](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/media/README.md))

Specifically, under the playback heading, media/ contains the implementations of components required for HTML media elements and extensions:

* [HTML5 Audio & Video](https://dev.w3.org/html5/spec-author-view/video.html)
* [Media Source Extensions](https://www.w3.org/TR/media-source/)
* [Encrypted Media Extensions](https://www.w3.org/TR/encrypted-media/)

The following diagram provides a simplified overview of the media playback pipeline and where LCEVC is integrated.

![Chromium architecture with LCEVC](https://content.gitbook.com/content/II3HaKNLFEqGvuN59zwF/blobs/pwGhXL5U08WLE2kp1aDj/0)

As seen in the previous figure, the LCEVC integration point receives the encoded image frame (plus the enhancement data) after being demuxed by the FFmpeg demuxer (HTML video element pipeline), chunk demuxer (Media Source Extensions pipeline), and from CDM in the Encrypted Media Extensions pipeline.

The following figure shows the design of the unmodified versus LCEVC integrated video pipeline which can be applied to Chromium in the DemuxerStream object.

!\[Unmodified versus LCEVC-enhanced decoding pipelines in Chromium

]\(<https://content.gitbook.com/content/II3HaKNLFEqGvuN59zwF/blobs/RZnKuo1IY6IDdyK6DfI8/1>)

### Supported formats <a href="#toc86073199" id="toc86073199"></a>

The V-Nova LCEVC Chromium integration adds support for;

* LCEVC H264 in an MP4 container
* LCEVC VP8 & VP9 in a WEBM container
* DRM Protected Content

### Components <a href="#toc86073200" id="toc86073200"></a>

The V-Nova LCEVC Chromium integration affects the media module in the following manner:

* media/filters/DecoderStream: Receives the encoded data and returns the decoded frame. Modified to pass LCEVC enhancement data to the LCEVC Decoder Integration Layer (DIL) and to use the DIL to generate the final video frame.
* media/lcevc/LcevcDecoderContext: handles DIL component integration.

### Usage <a href="#toc86073201" id="toc86073201"></a>

This integration is a fork from the Chromium open source project. The solution provides a way to dynamically load the LCEVC libraries. These libraries should be available in the following manner:

* Windows: the DLLs must be located in the executable directory or available through the PATH environment path
* Linux: Add the .so files location *to the LD\_LIBRARY\_PATH environment variable.*&#x20;

This integration detects the input format and adds the enhancement to every video played using the Chromium video pipeline, so no other modification is needed.

### Checkout, Build, & Run Chromium <a href="#toc86073202" id="toc86073202"></a>

In order to be able to build Chromium in your environment, you will need to follow the guidelines for your OS that can be found [here](https://www.chromium.org/developers/how-tos/get-the-code).

### Setting up the environment <a href="#toc86073203" id="toc86073203"></a>

In Windows, [Chromium ](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/windows_build_instructions.md#Setting-up-Windows)requires Visual Studio 2017 (>=15.7.2) to build, but VS2019 (>=16.0.0) is preferred and Windows SDK debug tools. Visual Studio can also be used to debug Chromium, and VS2019 is preferred for this as it handles Chromium's large debug information much better. The clang-cl compiler is used but Visual Studio's header files, libraries, and some tools are required. Visual Studio Community Edition should work if its license is appropriate for you. You must install the "Desktop development with C++" component and the "MFC/ATL support" sub-components.&#x20;

Full details of build prerequisites and instructions for Windows and Linux can be are provided by Chromium project here:

* <mark style="color:blue;">h</mark>[ttps://chromium.googlesource.com/chromium/src/+/HEAD/docs/windows\_build\_instructions.md](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/windows_build_instructions.md)

&#x20;You can then continue preparing your environment by installing the depot\_tools. These are tools for working with Chromium development.

### Getting the code <a href="#toc86073204" id="toc86073204"></a>

Access to the LCEVC Chromium repository can be requested by contacting V-Nova via <info@v-nova.com>.

The code for the Chromium project can be retrieved by using the fetch tool from depot\_tools, as described in&#x20;

* <mark style="color:blue;"><https://chromium.googlesource.com/chromium/src/+/main/docs/linux/build\\_instructions.md#Get-the-code> or</mark>&#x20;
* <mark style="color:blue;"><https://chromium.googlesource.com/chromium/src/+/HEAD/docs/windows\\_build\\_instructions.md#Get-the-code>.</mark>

Once the repository has been fetched, go into the Chromium git repository (in the `src` sub-directory), add the LCEVC-Chromium git repository as a remote, fetch and checkout its `main` branch, then sync the dependencies by using the following command:

`gclient sync -D --force --reset --with_branch_heads`

The binary libraries from the LCEVC SDK should then be copied to `media/lcevc_dependencies`, and the header files to `media/lcevc/includes`.

### Building <a href="#toc86073205" id="toc86073205"></a>

You can create any number of *build directories* with different configurations. To create a build directory:

`gn gen out/Default`

* You only have to run this once for each new build directory.
* You can replace Default with another name, but it should be a subdirectory of out.

### Enabling proprietary codecs and DRM (with Widevine) <a href="#toc86073206" id="toc86073206"></a>

In order to include support for H264, you need to enable proprietary codecs. Also, to enable DRM and EME (Encrypted Media Extensions) with [Widevine](https://www.widevine.com/) you need to add the following lines in the out/Default/args.gn file

``# Set build arguments here. See `gn help buildargs`.``

`ffmpeg_branding = "Chrome"`

`proprietary_codecs = true`

`enable_widevine = true`

### Building for Production <a href="#toc86073207" id="toc86073207"></a>

When building for Production, you should disable DCHECK as it stops Chromium execution when some validations are not met. This DCHECK is usually disabled in release distributions.

To disable DCHECK and create a Release build you should add the following lines in the out/Default/args.gn

`is_debug = false`

`dcheck_always_on = false`

### Add V-Nova DLLs to the system path in Windows <a href="#toc86073208" id="toc86073208"></a>

In order to use the V-Nova DLLs, you need to add this folder to the system path or copy all the DLLs to the chromium/src/out/Default folder.

### Add V-Nova libraries to the system path in Linux <a href="#toc86073209" id="toc86073209"></a>

In order to use the V-Nova .so files, you need to add this folder to the /usr/lib folder or add the dependency folder to the LD\_INCLUDE\_PATH.

### Build with autoninja <a href="#toc86073210" id="toc86073210"></a>

To build chromium, run the following command:

`autoninja -C out/Default chrome`

or, to produce installer packages:

`autoninja -C out/Default chrome/installer/mini_installer`

for Windows, or

&#x20;`autoninja -C out/Default chrome/installer/linux:unstable.deb`

for Debian-like Linux systems etc.

### Supported Operating Systems <a href="#toc86073211" id="toc86073211"></a>

* Windows 10
* Linux: Ubuntu 18.04, Ubuntu 20.04, Debian 10, Debian 11
