-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: LCEVC integration #4050
feat: LCEVC integration #4050
Changes from 16 commits
30c2008
701d5c9
bc5700e
a95f8e7
2f0e1c1
bced0ed
0dd90dd
b4e383c
428b006
fa32c46
2d3e8ef
ec136ef
155b5b3
213f29f
fb968ea
8d0ea37
588c6ab
92877e8
93d4d37
38a7f4e
ae01056
3183408
931057a
7a86ddb
3cb53ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,5 +78,6 @@ uStudio Inc. <*@ustudio.com> | |
Verizon Digital Media Services <*@verizondigitalmedia.com> | ||
ViacomCBS <*@viacomcbs.com> | ||
Vincent Valot <[email protected]> | ||
V-Nova Limited <*@v-nova.com> | ||
Wayne Morgan <[email protected]> | ||
Raymond Cheng <[email protected]> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,7 @@ Toshihiro Suzuki <[email protected]> | |
Vasanth Polipelli <[email protected]> | ||
Vignesh Venkatasubramanian <[email protected]> | ||
Vincent Valot <[email protected]> | ||
Vinod Balakrishnan <[email protected]> | ||
Wayne Morgan <[email protected]> | ||
Yohann Connell <[email protected]> | ||
Raymond Cheng <[email protected]> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
+@polyfill | ||
+@text | ||
+@ui | ||
+@lcevc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# LCEVC library. | ||
|
||
+../../lib/lcevc/lcevc_dil.js |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,7 @@ shakaDemo.Config = class { | |
this.addRetrictionsSection_('', | ||
shakaDemo.MessageIds.RESTRICTIONS_SECTION_HEADER); | ||
this.addCmcdSection_(); | ||
this.addLcevcSection_(); | ||
} | ||
|
||
/** | ||
|
@@ -287,6 +288,17 @@ shakaDemo.Config = class { | |
.addBoolInput_(MessageIds.USE_HEADERS, 'cmcd.useHeaders'); | ||
} | ||
|
||
/** @private */ | ||
addLcevcSection_() { | ||
const MessageIds = shakaDemo.MessageIds; | ||
const docLink = this.resolveExternLink_('.LcevcConfiguration'); | ||
this.addSection_(MessageIds.LCEVC_SECTION_HEADER, docLink) | ||
.addBoolInput_(MessageIds.LCEVC_DYNAMIC_PERFORMANCE_SCALING | ||
, 'lcevc.dynamicPerformanceScaling') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style nit: please move the comma to the previous line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fixed |
||
.addNumberInput_(MessageIds.LCEVC_LOG_LEVEL, 'lcevc.logLevel') | ||
.addBoolInput_(MessageIds.LCEVC_DRAW_LOGO, 'lcevc.drawLogo'); | ||
} | ||
|
||
/** | ||
* @param {string} category | ||
* @param {!shakaDemo.MessageIds} sectionName | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -439,6 +439,22 @@ | |
"description": "The header for a section of configuration values.", | ||
"message": "Language" | ||
}, | ||
"DEMO_LCEVC_DRAW_LOGO": { | ||
"description": "LCEVC Watermark on the left hand top corner of the canvas.", | ||
"message": "Draw LCEVC Logo [JARGON:LCEVC]" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The markup on these is wrong. [JARGON:LCEVC] is a hint to translators not to translate a word because it is jargon. So your message would be: "Draw [JARGON:LCEVC] Logo" You could also use: "Draw [PROPER_NAME:LCEVC] Logo" which may be more appropriate, since that is how we represent the DASH acronym as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is changed. |
||
}, | ||
"DEMO_LCEVC_DYNAMIC_PERFORMANCE_SCALING": { | ||
"description": "Dynamic Performance scaling for enabling/disabling LCEVC decoding based on decode performance.", | ||
"message": "LCEVC Dynamic Performance scaling [JARGON:LCEVC]" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here I think LCEVC is a proper name, and DPS is jargon. |
||
}, | ||
"DEMO_LCEVC_LOG_LEVEL": { | ||
"description": "Log Level for LCEVC Lib", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add something like " (0-5)" to the end of this description. Otherwise it's not clear in the demo UI if this is supposed to be a name like "ERROR" or "DEBUG". |
||
"message": "LCEVC Log Level [JARGON:LCEVC]" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix this one, too, please. |
||
}, | ||
"DEMO_LCEVC_SECTION_HEADER": { | ||
"description": "The header for a section of configuration values.", | ||
"message": "MPEG-5 Part-2 LCEVC [JARGON:LCEVC]" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think here, the whole thing is a proper name. |
||
}, | ||
"DEMO_LIBRARIES": { | ||
"description": "A link in the footer, to Shaka Player in the Google Hosted Libraries CDN.", | ||
"message": "[PROPER_NAME:Google Hosted Libraries]" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
|
||
# Shaka Player LCEVC integration | ||
|
||
# Introduction | ||
|
||
This article describes the V-Nova LCEVC Shaka Player integration. | ||
|
||
# LCEVC Integration | ||
|
||
## Adding V-Nova required files | ||
### Importing DIL - Decoder Integration Layer | ||
|
||
V-Nova LCEVC DIL Libraries are included using the same approach that the other external libraries are currently using. The necessary V-Nova LCEVC DIL files need to be imported in the HTML page that is going to be used by Shaka Player to decode LCEVC. Checks are inplace that make sure the necessary objects are available. | ||
|
||
Npm package : <https://www.npmjs.com/package/lcevc_dil.js> | ||
|
||
```javascript | ||
<!-- MPEG-5 Part2 LCEVC support is enabled by including this: --> | ||
<script defer src="../node_modules/lcevc_dil.js/dist/lcevc_dil.min.js"></script> | ||
``` | ||
|
||
To allow the Closure compiler to use the objects and methods that are exported by the DIL.js a new `extern` is created. | ||
|
||
### Defining an Extern for LCEVC | ||
|
||
`externs/lcevc.js` exposes the functions from the LCEVC DIL library required for LCEVC Decoding. | ||
|
||
## Integration point | ||
|
||
### The shaka.lcevc.Dil class - (DIL : Decoder Integration Layer) | ||
|
||
The main logic of the LCEVC integration is located in the `lib/lcevc_dil.min.js` file. In this file the shaka.lcevc.Dil is exported to be used in the project. This class is in charge of creating the Dil object using the mentioned externs, checking if LCEVC DIL library is available, etc. | ||
|
||
### Modifications in the player | ||
|
||
The shaka.Player class, defined in the `lib/player.js` file, is the main player object for Shaka Player. There is a setter function for setting up a `canvas` element that is received from the user. | ||
If shaka.ui is used the `canvas` is created in line with the video element in the same container overlaying the video element. If user provides a custom canvas using the setter function, The user is responsible for placing the canvas element in the desired position and resizing it. | ||
|
||
`shaka.externs.LcevcConfiguration` is added to the `playerConfiguration` that is used as configuration for the LCEVC DIL Library. | ||
|
||
The Dil object is created in the `onLoad_()` event that is triggered when a new video is loaded in Shaka Player. Attaching to a media element is defined as: | ||
|
||
- Registering error listeners to the media element. | ||
- Catching the video element for use outside of the load graph. | ||
|
||
The Dil object is created only if LCEVC is supported (LCEVC libs are loaded on the page) and also when it was not already created in another `onLoad_()` event execution. | ||
|
||
|
||
### Feeding the Dil | ||
|
||
The logic that Shaka Player uses to communicate with the Media Source Extensions (MSE) is located in the `media/media_source_engine.js` file. | ||
|
||
![image.png](lcevc-architecture.png) | ||
|
||
`append_()` function that is used to feed the MSE Source Buffer is intercepted and modified to pass the video buffers to the LCEVC DIL Libraries before appending to the MSE Source Buffers. | ||
|
||
## Demo page | ||
|
||
The relevant libraries are added in the Demo Page like so: | ||
|
||
```javascript | ||
<!-- MPEG-5 Part2 LCEVC support is enabled by including this: --> | ||
<script defer src="../node_modules/lcevc_dil.js/dist/lcevc_dil.min.js"></script> | ||
``` | ||
|
||
And a new video sample with enhancement data is added to the `demo/common/assets.js` file under a new source `MPEG-5 Part 2 LCEVC`. | ||
|
||
After these changes the demo page looks like : | ||
|
||
![image.png](lcevc-demo.png) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/** | ||
* @fileoverview Externs for LcevcDil | ||
* compiler. | ||
* | ||
* @externs | ||
*/ | ||
|
||
// This empty namespace is declared to check if LcevcDil libraries are loaded. | ||
var libDPIModule = {}; | ||
joeyparrish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var LcevcDil = {}; | ||
|
||
/** | ||
* LCEVC DIL constructor | ||
* @constructor | ||
*/ | ||
LcevcDil.LcevcDIL = class { | ||
/** | ||
* @param {HTMLVideoElement} media | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. formatting: The /**
* @param ...
*/ |
||
* @param {Element} canvas | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be a canvas element specifically? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (good catch, really ought to be as it can't be anything else) |
||
* @param {shaka.extern.LcevcConfiguration} dilConfig | ||
*/ | ||
constructor(media, canvas, dilConfig) { | ||
} | ||
|
||
/** | ||
* Append the video buffers before they are appended to | ||
* Media Source Extensions SourceBuffer. Here the lcevc data | ||
* will be parsed and managed to enahnce frames based on timestamps. | ||
* | ||
* @param {!BufferSource} data Video Buffer Data. | ||
* @param {string} type Type of Video Buffer Data. | ||
* @param {number} variantId Variant that the fragment belongs to. | ||
*/ | ||
appendBuffer(data, type, variantId) {} | ||
|
||
/** | ||
* Set current variant as variantId to the LCEVC decoder | ||
* @param {!number} variantId | ||
* @param {!boolean} autoBufferSwitch is lcevcDil mode that switches variant | ||
* when the downloaded buffer from last variant has finished playing and | ||
* buffers from the new variant starts to play. | ||
*/ | ||
setLevelSwitching(variantId, autoBufferSwitch) {} | ||
|
||
/** | ||
* Set container Format for LCEVC Data Parsing. | ||
* @param {!number} containerFormat container type of the stream. | ||
*/ | ||
setContainerFormat(containerFormat) {} | ||
|
||
/** | ||
* Close LCEVC DIL | ||
*/ | ||
close() {} | ||
}; | ||
|
||
/** | ||
* LCEVC Support Check | ||
*/ | ||
LcevcDil.SupportObject = { | ||
|
||
/** | ||
* Check if canvas has WebGL support | ||
* @param {Element} canvas | ||
* @return {boolean} true if requirements are met. | ||
*/ | ||
webGLSupport(canvas) {}, | ||
|
||
}; | ||
|
||
/** | ||
* LCEVC Support Checklist Result | ||
* @type {boolean} | ||
*/ | ||
LcevcDil.SupportObject.SupportStatus; | ||
|
||
/** | ||
* LCEVC Support CheckList Error if any. | ||
* @type {string} | ||
*/ | ||
LcevcDil.SupportObject.SupportError; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make a new message ID in the same part of the file as the other source messages. Given what you put as the config section header, reusing it here would make the source of the asset read as "MPEG-5 Part-2 LCEVC".
In fact, "V-Nova" might be more appropriate as the creator of the asset anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a new section V-Nova for LCEVC assets