Skip to content

Commit

Permalink
Feature/improved codec check support (Dash-Industry-Forum#4575)
Browse files Browse the repository at this point in the history
* WiP: Avoid duplicate codec capability checks

* Optimize capabilities check by saving previously executed checks and avoid any duplicate checks

* Add additional unit tests

* Fix bug in Capabilities.js

* Remove line in package.json

* Add forced subtitle stream to reference client

* Skip MediaCapability tests on Linux Firefox

* Change CircleCI config to use medium+ resource class for the build

* Change CircleCI config to use large resource class for the execution
  • Loading branch information
dsilhavy authored Sep 27, 2024
1 parent 3cad63d commit 1e3c027
Show file tree
Hide file tree
Showing 13 changed files with 596 additions and 306 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ orbs:
executors:
dashjs-executor:
working_directory: ~/repo
resource_class: large
docker:
- image: cimg/node:20.11.1

Expand Down
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"globals": {
"dashjs": true,
"ManagedMediaSource": true,
"WebKitMediaSource": true,
"MediaSource": true,
"WebKitMediaKeys": true,
Expand Down
8 changes: 5 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ declare namespace dashjs {

getAdaptationsForType(manifest: object, periodIndex: number, type: string): any[];

getCodec(adaptation: object, representationId: number, addResolutionInfo: boolean): string;
getCodec(adaptation: object, representationIndex: number, addResolutionInfo: boolean): string;

getMimeType(adaptation: object): object;

Expand Down Expand Up @@ -754,7 +754,7 @@ declare namespace dashjs {

getRepresentationSortFunction(): (a: object, b: object) => number;

getCodec(adaptation: object, representationId: number, addResolutionInfo: boolean): string;
getCodec(adaptation: object, representationIndex: number, addResolutionInfo: boolean): string;

getBandwidthForRepresentation(representationId: string, periodIdx: number): number;

Expand Down Expand Up @@ -3998,7 +3998,9 @@ declare namespace dashjs {

supportsEncryptedMedia(): boolean;

supportsCodec(config: object, type: string): Promise<boolean>;
isCodecSupportedBasedOnTestedConfigurations(basicConfiguration: object, type: string): boolean;

runCodecSupportCheck(basicConfiguration: object, type: string): Promise<void>;

setEncryptedMediaSupported(value: boolean): void;

Expand Down
10 changes: 10 additions & 0 deletions samples/dash-if-reference-player/app/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
"acronym": "Dolby",
"name": "Dolby Laboratories Inc.",
"url": "https://www.dolby.com/"
},
"arte": {
"acronym": "ARTE",
"name": "ARTE",
"url": "https://www.arte.tv/en/"
}
},
"items": [
Expand Down Expand Up @@ -473,6 +478,11 @@
"url": "https://dash.akamaized.net/dash264/CTA/imsc1/IT1-20171027_dash.mpd",
"name": "IMSC1 Text Subtitles via sidecar file",
"provider": "cta"
},
{
"name": "Arte forced-subtitles",
"url": "https://arteamd1.akamaized.net/GPU/034000/034700/034755-230-A/221125154117/034755-230-A_8_DA_v20221125.mpd",
"provider": "arte"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions src/dash/DashAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ function DashAdapter() {
* @memberOf module:DashAdapter
* @instance
*/
function getCodec(adaptation, representationId, addResolutionInfo) {
return dashManifestModel.getCodec(adaptation, representationId, addResolutionInfo);
function getCodec(adaptation, representationIndex, addResolutionInfo) {
return dashManifestModel.getCodec(adaptation, representationIndex, addResolutionInfo);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/dash/models/DashManifestModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,12 @@ function DashManifestModel() {
return adaptations;
}

function getCodec(adaptation, representationId, addResolutionInfo) {
function getCodec(adaptation, representationIndex, addResolutionInfo) {
let codec = null;

if (adaptation && adaptation.Representation && adaptation.Representation.length > 0) {
const representation = isInteger(representationId) && representationId >= 0 && representationId < adaptation.Representation.length ?
adaptation.Representation[representationId] : adaptation.Representation[0];
const representation = isInteger(representationIndex) && representationIndex >= 0 && representationIndex < adaptation.Representation.length ?
adaptation.Representation[representationIndex] : adaptation.Representation[0];
if (representation) {
codec = representation.mimeType + ';codecs="' + representation.codecs + '"';
if (addResolutionInfo && representation.width !== undefined) {
Expand Down
Loading

0 comments on commit 1e3c027

Please sign in to comment.