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(MSS): Fix timeline repetitions #7484

Merged
merged 2 commits into from
Oct 24, 2024
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
6 changes: 6 additions & 0 deletions lib/mss/mss_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,12 @@ shaka.mss.MssParser = class {
let startTime = t != null ? t : lastEndTime;

let repeat = r || 0;
// Unlike in DASH, in MSS r does not start counting repetitions at 0 but
// at 1, to maintain the code equivalent to DASH if r exists we
// subtract 1.
if (repeat) {
repeat--;
}
if (repeat < 0) {
if (next) {
const nextStartTime =
Expand Down
21 changes: 21 additions & 0 deletions test/mss/mss_parser_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,27 @@ describe('MssParser Manifest', () => {
expect(stream).toBeUndefined();
});

it('support for repetitions', async () => {
const manifestText = [
'<SmoothStreamingMedia Duration="3600000000">',
' <StreamIndex Name="audio" Type="audio" Url="{bitrate}/{start time}">',
' <QualityLevel Bitrate="128000" Channels="2" CodecPrivateData="',
aacCodecPrivateData,
'" FourCC="AACL"/>',
' <c t="0" d="30000000" r="12"/>',
' </StreamIndex>',
'</SmoothStreamingMedia>',
].join('\n');

fakeNetEngine.setResponseText('dummy://foo', manifestText);

const manifest = await parser.start('dummy://foo', playerInterface);
expect(manifest.variants.length).toBe(1);
await manifest.variants[0].audio.createSegmentIndex();
const segmentIndex = manifest.variants[0].audio.segmentIndex;
expect(segmentIndex.getNumReferences()).toBe(12);
});

it('generate a fake init segment', async () => {
const manifestText = [
'<SmoothStreamingMedia Duration="3600000000">',
Expand Down
Loading