Skip to content
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

fix: Fix deprecation warning for manifestPreprocessor that is always logged #6496

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ goog.require('shaka.util.MimeUtils');
goog.require('shaka.util.Networking');
goog.require('shaka.util.OperationManager');
goog.require('shaka.util.PeriodCombiner');
goog.require('shaka.util.PlayerConfiguration');
goog.require('shaka.util.StringUtils');
goog.require('shaka.util.Timer');
goog.require('shaka.util.TXml');
Expand Down Expand Up @@ -338,7 +339,9 @@ shaka.dash.DashParser = class {
async parseManifest_(data, finalManifestUri) {
let manifestData = data;
const manifestPreprocessor = this.config_.dash.manifestPreprocessor;
if (manifestPreprocessor) {
const defaultManifestPreprocessor =
shaka.util.PlayerConfiguration.defaultManifestPreprocessor;
if (manifestPreprocessor != defaultManifestPreprocessor) {
shaka.Deprecate.deprecateFeature(5,
'manifest.dash.manifestPreprocessor configuration',
'Please Use manifest.dash.manifestPreprocessorTXml instead.');
Expand All @@ -364,7 +367,9 @@ shaka.dash.DashParser = class {
}
const manifestPreprocessorTXml =
this.config_.dash.manifestPreprocessorTXml;
if (manifestPreprocessorTXml) {
const defaultManifestPreprocessorTXml =
shaka.util.PlayerConfiguration.defaultManifestPreprocessorTXml;
if (manifestPreprocessorTXml != defaultManifestPreprocessorTXml) {
manifestPreprocessorTXml(mpd);
}

Expand Down
9 changes: 7 additions & 2 deletions lib/mss/mss_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ goog.require('shaka.util.ManifestParserUtils');
goog.require('shaka.util.MimeUtils');
goog.require('shaka.util.Mp4Generator');
goog.require('shaka.util.OperationManager');
goog.require('shaka.util.PlayerConfiguration');
goog.require('shaka.util.Timer');
goog.require('shaka.util.TXml');
goog.require('shaka.util.XmlUtils');
Expand Down Expand Up @@ -282,7 +283,9 @@ shaka.mss.MssParser = class {
parseManifest_(data, finalManifestUri) {
let manifestData = data;
const manifestPreprocessor = this.config_.mss.manifestPreprocessor;
if (manifestPreprocessor) {
const defaultManifestPreprocessor =
shaka.util.PlayerConfiguration.defaultManifestPreprocessor;
if (manifestPreprocessor != defaultManifestPreprocessor) {
shaka.Deprecate.deprecateFeature(5,
'manifest.mss.manifestPreprocessor configuration',
'Please Use manifest.mss.manifestPreprocessorTXml instead.');
Expand All @@ -307,7 +310,9 @@ shaka.mss.MssParser = class {
finalManifestUri);
}
const manifestPreprocessorTXml = this.config_.mss.manifestPreprocessorTXml;
if (manifestPreprocessorTXml) {
const defaultManifestPreprocessorTXml =
shaka.util.PlayerConfiguration.defaultManifestPreprocessorTXml;
if (manifestPreprocessorTXml != defaultManifestPreprocessorTXml) {
manifestPreprocessorTXml(mss);
}
this.processManifest_(mss, finalManifestUri);
Expand Down
48 changes: 28 additions & 20 deletions lib/util/player_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,10 @@ shaka.util.PlayerConfiguration = class {
'urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95':
'com.microsoft.playready',
},
manifestPreprocessor: (element) => {
return shaka.util.ConfigUtils.referenceParametersAndReturn(
[element],
element);
},
manifestPreprocessorTXml: (element) => {
return shaka.util.ConfigUtils.referenceParametersAndReturn(
[element],
element);
},
manifestPreprocessor:
shaka.util.PlayerConfiguration.defaultManifestPreprocessor,
manifestPreprocessorTXml:
shaka.util.PlayerConfiguration.defaultManifestPreprocessorTXml,
sequenceMode: false,
enableAudioGroups: false,
multiTypeVariantsAllowed,
Expand All @@ -174,16 +168,10 @@ shaka.util.PlayerConfiguration = class {
allowLowLatencyByteRangeOptimization: true,
},
mss: {
manifestPreprocessor: (element) => {
return shaka.util.ConfigUtils.referenceParametersAndReturn(
[element],
element);
},
manifestPreprocessorTXml: (element) => {
return shaka.util.ConfigUtils.referenceParametersAndReturn(
[element],
element);
},
manifestPreprocessor:
shaka.util.PlayerConfiguration.defaultManifestPreprocessor,
manifestPreprocessorTXml:
shaka.util.PlayerConfiguration.defaultManifestPreprocessorTXml,
sequenceMode: false,
keySystemsBySystemId: {
'9a04f079-9840-4286-ab92-e65be0885f95':
Expand Down Expand Up @@ -615,4 +603,24 @@ shaka.util.PlayerConfiguration = class {

return selectedTracks;
}

/**
* @param {!Element} element
* @return {!Element}
*/
static defaultManifestPreprocessor(element) {
return shaka.util.ConfigUtils.referenceParametersAndReturn(
[element],
element);
}

/**
* @param {!shaka.extern.xml.Node} element
* @return {!shaka.extern.xml.Node}
*/
static defaultManifestPreprocessorTXml(element) {
return shaka.util.ConfigUtils.referenceParametersAndReturn(
[element],
element);
}
};
Loading