Skip to content

Commit

Permalink
fix: player Dropping Variant (better codec available) when it should …
Browse files Browse the repository at this point in the history
…not (#6163)

Fixes #6162
  • Loading branch information
avelad committed Jan 25, 2024
1 parent 65981e2 commit 07ebdb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/util/stream_utils.js
Expand Up @@ -162,7 +162,7 @@ shaka.util.StreamUtils = class {
const currentCodec =
MimeUtils.getNormalizedCodec(stream.codecs);
if (previousCodec == currentCodec) {
if (stream.bandwidth < previousStream.bandwidth) {
if (stream.bandwidth > previousStream.bandwidth) {
validVideoStreams.push(stream);
validVideoIds.push(stream.id);
}
Expand Down
10 changes: 2 additions & 8 deletions test/util/stream_utils_unit.js
Expand Up @@ -825,21 +825,15 @@ describe('StreamUtils', () => {
stream.size(20, 20);
});
});
manifest.addVariant(6, (variant) => {
variant.addVideo(7, (stream) => {
stream.bandwidth = 600000;
stream.size(20, 20);
});
});
});

shaka.util.StreamUtils.chooseCodecsAndFilterManifest(manifest,
/* preferredVideoCodecs= */[],
/* preferredAudioCodecs= */[],
/* preferredDecodingAttributes= */[]);

expect(manifest.variants.length).toBe(2);
expect(manifest.variants.every((v) => [300000, 500000].includes(
expect(manifest.variants.length).toBe(3);
expect(manifest.variants.every((v) => [300000, 400000, 500000].includes(
v.video.bandwidth))).toBeTruthy();
});

Expand Down

0 comments on commit 07ebdb1

Please sign in to comment.