Skip to content

Commit

Permalink
example based criteria should use the adaptation set criteria factory…
Browse files Browse the repository at this point in the history
… as well
  • Loading branch information
gkatsev committed Jan 13, 2025
1 parent 88cdbed commit 858c2af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/media/example_based_criteria.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
goog.provide('shaka.media.ExampleBasedCriteria');

goog.require('shaka.media.AdaptationSetCriteria');
goog.require('shaka.media.PreferenceBasedCriteria');
goog.requireType('shaka.config.CodecSwitchingStrategy');


Expand All @@ -20,8 +19,10 @@ shaka.media.ExampleBasedCriteria = class {
/**
* @param {shaka.extern.Variant} example
* @param {shaka.config.CodecSwitchingStrategy} codecSwitchingStrategy
* @param {shaka.media.AdaptationSetCriteria.Factory}
* adaptationSetCriteriaFactory
*/
constructor(example, codecSwitchingStrategy) {
constructor(example, codecSwitchingStrategy, adaptationSetCriteriaFactory) {
// We can't know if role and label are really important, so we don't use
// role and label for this.
const role = '';
Expand All @@ -39,7 +40,7 @@ shaka.media.ExampleBasedCriteria = class {
example.audio.codecs : '';

/** @private {!shaka.media.AdaptationSetCriteria} */
this.preferenceBasedCriteria_ = new shaka.media.PreferenceBasedCriteria();
this.preferenceBasedCriteria_ = adaptationSetCriteriaFactory();
this.preferenceBasedCriteria_.configure({
language: example.language,
role,
Expand Down
3 changes: 2 additions & 1 deletion lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -5189,7 +5189,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
// currentAudioLanguage_.
this.currentAdaptationSetCriteria_ = new shaka.media.ExampleBasedCriteria(
variant,
this.config_.mediaSource.codecSwitchingStrategy);
this.config_.mediaSource.codecSwitchingStrategy,
this.config_.adaptationSetCriteriaFactory);

// Update AbrManager variants to match these new settings.
this.updateAbrManagerVariants_();
Expand Down

0 comments on commit 858c2af

Please sign in to comment.