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(dash): Account for bandwidth before filtering text stream #3765

Merged
merged 4 commits into from Mar 22, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -31,6 +31,7 @@ Edgeware AB <*@edgeware.tv>
Esteban Dosztal <edosztal@gmail.com>
Fadomire <fadomire@gmail.com>
Gil Gonen <gil.gonen@gmail.com>
Giorgio Gamberoni <giorgio.gamberoni@gmail.com>
Giuseppe Samela <giuseppe.samela@gmail.com>
Google Inc. <*@google.com>
Itay Kinnrot <Itay.Kinnrot@Kaltura.com>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Expand Up @@ -48,6 +48,7 @@ Esteban Dosztal <edosztal@gmail.com>
Fadomire <fadomire@gmail.com>
François Beaufort <fbeaufort@google.com>
Gil Gonen <gil.gonen@gmail.com>
Giorgio Gamberoni <giorgio.gamberoni@gmail.com>
Giuseppe Samela <giuseppe.samela@gmail.com>
Hichem Taoufik <hichem@code-it.fr>
Itay Kinnrot <itay.kinnrot@kaltura.com>
Expand Down
1 change: 1 addition & 0 deletions lib/util/periods.js
Expand Up @@ -298,6 +298,7 @@ shaka.util.PeriodCombiner = class {
t1.label == t2.label &&
t1.codecs == t2.codecs &&
t1.mimeType == t2.mimeType &&
t1.bandwidth == t2.bandwidth &&
ArrayUtils.hasSameElements(t1.roles, t2.roles)) {
duplicate = true;
}
Expand Down
15 changes: 13 additions & 2 deletions test/util/periods_unit.js
Expand Up @@ -477,7 +477,7 @@ describe('PeriodCombiner', () => {
a3.originalId = 'a3';
a3.bandwidth = 97065;
a3.roles = ['role1', 'role2'];
a2.codecs = 'mp4a.40.2';
a3.codecs = 'mp4a.40.2';

// a4 has a different label from a3, and should not
// be filtered out.
Expand All @@ -500,14 +500,24 @@ describe('PeriodCombiner', () => {
const t1 = makeTextStream('en');
t1.originalId = 't1';
t1.roles = ['role1'];
t1.bandwidth = 1158;

const t2 = makeTextStream('en');
t2.originalId = 't2';
t2.roles = ['role1', 'role2'];
t2.bandwidth = 1172;

const t3 = makeTextStream('en');
t3.originalId = 't3';
t3.roles = ['role1'];
t3.bandwidth = 1158;

// t4 has a different bandwidth from t3, and should not
// be filtered out.
const t4 = makeTextStream('en');
t4.originalId = 't4';
t4.roles = ['role1'];
t4.bandwidth = 1186;

// i1 and i3 are duplicates.
const i1 = makeImageStream(240);
Expand Down Expand Up @@ -539,6 +549,7 @@ describe('PeriodCombiner', () => {
t1,
t2,
t3,
t4,
],
imageStreams: [
i1,
Expand All @@ -565,7 +576,7 @@ describe('PeriodCombiner', () => {
}

const textStreams = combiner.getTextStreams();
expect(textStreams.length).toBe(2);
expect(textStreams.length).toBe(3);

// t3 should've been filtered out
const textIds = textStreams.map((t) => t.originalId);
Expand Down