Skip to content

Commit

Permalink
feat: Improved LCEVC integration (shaka-project#4560)
Browse files Browse the repository at this point in the history
- Allow enable/disable LCEVC via configuration
- Add LCEVC filtering in the demo
- Add a new LCEVC asset
  • Loading branch information
avelad authored Oct 20, 2022
1 parent bf50ada commit 50062f5
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 16 deletions.
30 changes: 30 additions & 0 deletions demo/common/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ shakaAssets.Feature = {

// Set if the asset has at least one image stream.
THUMBNAILS: shakaDemo.MessageIds.THUMBNAILS,

// Set if the asset has LCEVC.
LCEVC: shakaDemo.MessageIds.LCEVC,
};


Expand Down Expand Up @@ -1297,6 +1300,7 @@ shakaAssets.testAssets = [
.addFeature(shakaAssets.Feature.MP4)
.addFeature(shakaAssets.Feature.WEBM)
.addFeature(shakaAssets.Feature.OFFLINE)
.addFeature(shakaAssets.Feature.LCEVC)
.addDescription('H264 HLS stream with LCEVC enhancement')
.markAsFeatured('Big Buck Bunny (LCEVC H264)')
.setExtraConfig({
Expand All @@ -1305,6 +1309,32 @@ shakaAssets.testAssets = [
forceTransmuxTS: true,
},
lcevc: {
enabled: true,
dynamicPerformanceScaling: true,
logLevel: 0,
drawLogo: false,
},
}),
new ShakaDemoAssetInfo(
/* name= */ 'Game (LCEVC H264)',
/* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/big_buck_bunny.png',
/* manifestUri= */ 'https://dyctis843rxh5.cloudfront.net/vny72tI8aXJDcTYX/master.m3u8',
/* source= */ shakaAssets.Source.VNOVA)
.addFeature(shakaAssets.Feature.HLS)
.addFeature(shakaAssets.Feature.HIGH_DEFINITION)
.addFeature(shakaAssets.Feature.MP4)
.addFeature(shakaAssets.Feature.WEBM)
.addFeature(shakaAssets.Feature.OFFLINE)
.addFeature(shakaAssets.Feature.LCEVC)
.addDescription('H264 HLS stream with LCEVC enhancement')
.markAsFeatured('Game (LCEVC H264)')
.setExtraConfig({
streaming: {
useNativeHlsOnSafari: false,
forceTransmuxTS: true,
},
lcevc: {
enabled: true,
dynamicPerformanceScaling: true,
logLevel: 0,
drawLogo: false,
Expand Down
1 change: 1 addition & 0 deletions demo/common/message_ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ shakaDemo.MessageIds = {
DASH: 'DEMO_DASH',
HIGH_DEFINITION: 'DEMO_HIGH_DEFINITION',
HLS: 'DEMO_HLS',
LCEVC: 'DEMO_LCEVC',
LIVE: 'DEMO_LIVE',
MP2TS: 'DEMO_MP2TS',
MP4: 'DEMO_MP4',
Expand Down
1 change: 1 addition & 0 deletions demo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ shakaDemo.Config = class {
const MessageIds = shakaDemo.MessageIds;
const docLink = this.resolveExternLink_('.LcevcConfiguration');
this.addSection_(MessageIds.LCEVC_SECTION_HEADER, docLink)
.addBoolInput_(MessageIds.ENABLED, 'lcevc.enabled')
.addBoolInput_(MessageIds.LCEVC_DYNAMIC_PERFORMANCE_SCALING,
'lcevc.dynamicPerformanceScaling')
.addNumberInput_(MessageIds.LCEVC_LOG_LEVEL, 'lcevc.logLevel')
Expand Down
1 change: 1 addition & 0 deletions demo/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"DEMO_IRT": "IRT",
"DEMO_JSDELIVR": "jsDelivr",
"DEMO_LANGUAGE_SECTION_HEADER": "Language",
"DEMO_LCEVC": "LCEVC",
"DEMO_LCEVC_DRAW_LOGO": "Draw LCEVC Logo",
"DEMO_LCEVC_DYNAMIC_PERFORMANCE_SCALING": "LCEVC Dynamic Performance scaling",
"DEMO_LCEVC_LOG_LEVEL": "LCEVC Log Level",
Expand Down
4 changes: 4 additions & 0 deletions demo/locales/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@
"description": "The header for a section of configuration values.",
"message": "Language"
},
"DEMO_LCEVC": {
"description": "Text that describes an asset that has LCEVC.",
"message": "[PROPER_NAME:LCEVC]"
},
"DEMO_LCEVC_DRAW_LOGO": {
"description": "LCEVC Watermark on the top left hand corner of the canvas.",
"message": "Draw [PROPER_NAME:LCEVC] Logo"
Expand Down
2 changes: 2 additions & 0 deletions demo/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ shakaDemo.Search = class {
shakaDemo.MessageIds.AUDIO_ONLY_SEARCH);
this.makeBooleanInput_(specialContainer, Feature.THUMBNAILS, FEATURE,
shakaDemo.MessageIds.THUMBNAILS);
this.makeBooleanInput_(specialContainer, Feature.LCEVC, FEATURE,
shakaDemo.MessageIds.LCEVC);

container.appendChild(this.resultsDiv_);
}
Expand Down
4 changes: 4 additions & 0 deletions externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,7 @@ shaka.extern.CmcdConfiguration;

/**
* @typedef {{
* enabled: boolean,
* dynamicPerformanceScaling: boolean,
* logLevel: number,
* drawLogo: boolean
Expand All @@ -1226,6 +1227,9 @@ shaka.extern.CmcdConfiguration;
* @description
* Decoding for MPEG-5 Part2 LCEVC.
*
* @property {boolean} enabled
* If <code>true</code>, enable LCEVC.
* Defaults to <code>false</code>.
* @property {boolean} dynamicPerformanceScaling
* If <code>true</code>, LCEVC Dynamic Performance Scaling or dps is enabled
* to be triggered, when the system is not able to decode frames within a
Expand Down
36 changes: 20 additions & 16 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,25 +791,29 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
* @private
*/
setupLcevc_(config) {
const tracks = this.getVariantTracks();
if (tracks && tracks[0] &&
tracks[0].videoMimeType ==
shaka.Player.SRC_EQUAL_EXTENSIONS_TO_MIME_TYPES_['ts']) {
const edge = shaka.util.Platform.isEdge() ||
shaka.util.Platform.isLegacyEdge();
if (edge) {
if (!config.streaming.forceTransmuxTS) {
// If forceTransmux is disabled for Microsoft Edge, LCEVC data
// is stripped out in case of a MPEG-2 TS container.
// Hence the warning for Microsoft Edge when playing content with
// MPEG-2 TS container.
shaka.log.alwaysWarn('LCEVC Warning: For MPEG-2 TS decoding '+
'the config.streaming.forceTransmux must be enabled.');
if (config.lcevc.enabled) {
const tracks = this.getVariantTracks();
if (tracks && tracks[0] &&
tracks[0].videoMimeType ==
shaka.Player.SRC_EQUAL_EXTENSIONS_TO_MIME_TYPES_['ts']) {
const edge = shaka.util.Platform.isEdge() ||
shaka.util.Platform.isLegacyEdge();
if (edge) {
if (!config.streaming.forceTransmuxTS) {
// If forceTransmux is disabled for Microsoft Edge, LCEVC data
// is stripped out in case of a MPEG-2 TS container.
// Hence the warning for Microsoft Edge when playing content with
// MPEG-2 TS container.
shaka.log.alwaysWarn('LCEVC Warning: For MPEG-2 TS decoding '+
'the config.streaming.forceTransmux must be enabled.');
}
}
}
this.closeLcevcDil_();
this.createLcevcDil_(config.lcevc);
} else {
this.closeLcevcDil_();
}
this.closeLcevcDil_();
this.createLcevcDil_(config.lcevc);
}

/**
Expand Down
1 change: 1 addition & 0 deletions lib/util/player_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ shaka.util.PlayerConfiguration = class {
};

const lcevc = {
enabled: false,
dynamicPerformanceScaling: true,
logLevel: 0,
drawLogo: false,
Expand Down

0 comments on commit 50062f5

Please sign in to comment.