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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Edgeware AB <*@edgeware.tv>
Esteban Dosztal <[email protected]>
Fadomire <[email protected]>
Gil Gonen <[email protected]>
Giorgio Gamberoni <[email protected]>
Giuseppe Samela <[email protected]>
Google Inc. <*@google.com>
Itay Kinnrot <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Esteban Dosztal <[email protected]>
Fadomire <[email protected]>
François Beaufort <[email protected]>
Gil Gonen <[email protected]>
Giorgio Gamberoni <[email protected]>
Giuseppe Samela <[email protected]>
Hichem Taoufik <[email protected]>
Itay Kinnrot <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions lib/util/periods.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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