Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Oct 3, 2023
1 parent 2a35905 commit d38fde7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
40 changes: 21 additions & 19 deletions test/dash/dash_parser_segment_list_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,26 +352,28 @@ describe('DashParser SegmentList', () => {
newDrmInfo: (stream) => {},
onManifestUpdated: () => {},
};
const manifest = await dashParser.start('dummy://foo', playerInterface);
const stream = manifest.variants[0].video;
await stream.createSegmentIndex();
goog.asserts.assert(stream.segmentIndex, 'Expected index to be created');
try {
const manifest = await dashParser.start('dummy://foo', playerInterface);
const stream = manifest.variants[0].video;
await stream.createSegmentIndex();
goog.asserts.assert(stream.segmentIndex, 'Expected index to be created');

// Don't use Dash.testSegmentIndex since it uses SegmentIndex.find, which
// doesn't reproduce this issue. We want to use Array.from which uses the
// iterator.
const expected = [
ManifestParser.makeReference('s1.mp4', 0, 10, baseUri),
ManifestParser.makeReference('s2.mp4', 10, 20, baseUri),
ManifestParser.makeReference('s3.mp4', 20, 30, baseUri),

ManifestParser.makeReference('s3.mp4', 30, 40, baseUri),
ManifestParser.makeReference('s4.mp4', 40, 50, baseUri),
ManifestParser.makeReference('s5.mp4', 50, 60, baseUri),
];
const actual = Array.from(stream.segmentIndex);
expect(actual).toEqual(expected);
// Don't use Dash.testSegmentIndex since it uses SegmentIndex.find, which
// doesn't reproduce this issue. We want to use Array.from which uses
// the iterator.
const expected = [
ManifestParser.makeReference('s1.mp4', 0, 10, baseUri),
ManifestParser.makeReference('s2.mp4', 10, 20, baseUri),
ManifestParser.makeReference('s3.mp4', 20, 30, baseUri),

dashParser.stop();
ManifestParser.makeReference('s3.mp4', 30, 40, baseUri),
ManifestParser.makeReference('s4.mp4', 40, 50, baseUri),
ManifestParser.makeReference('s5.mp4', 50, 60, baseUri),
];
const actual = Array.from(stream.segmentIndex);
expect(actual).toEqual(expected);
} finally {
dashParser.stop();
}
});
});
25 changes: 15 additions & 10 deletions test/test/util/dash_parser_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ shaka.test.Dash = class {
newDrmInfo: (stream) => {},
onManifestUpdated: () => {},
};
const manifest = await dashParser.start('dummy://foo', playerInterface);
const stream = manifest.variants[0].video;
await stream.createSegmentIndex();

shaka.test.ManifestParser.verifySegmentIndex(stream, references);
try {
const manifest = await dashParser.start('dummy://foo', playerInterface);
const stream = manifest.variants[0].video;
await stream.createSegmentIndex();

dashParser.stop();
shaka.test.ManifestParser.verifySegmentIndex(stream, references);
} finally {
dashParser.stop();
}
}

/**
Expand Down Expand Up @@ -86,11 +88,14 @@ shaka.test.Dash = class {
newDrmInfo: (stream) => {},
onManifestUpdated: () => {},
};
const p = dashParser.start('dummy://foo', playerInterface);
await expectAsync(p).toBeRejectedWith(
shaka.test.Util.jasmineError(expectedError));

dashParser.stop();
try {
const p = dashParser.start('dummy://foo', playerInterface);
await expectAsync(p).toBeRejectedWith(
shaka.test.Util.jasmineError(expectedError));
} finally {
dashParser.stop();
}
}

/**
Expand Down

0 comments on commit d38fde7

Please sign in to comment.