Standardize argument comments.

This changes the eslint rule to enforce a strict pattern for the
argument comments.  The comment must appear before the argument and
must be /* foo= */.  This still ignores line comments.

Change-Id: I3afb01c65e1088eda13facb3aeeaa7595a2f5aee
This commit is contained in:
Jacob Trimble
2019-12-19 15:18:28 -08:00
parent cdbf8c5fbc
commit 011749e95f
66 changed files with 584 additions and 547 deletions
@@ -21,9 +21,34 @@ module.exports = {
return {
':matches(CallExpression, NewExpression)': (node) => {
for (const arg of node.arguments) {
const comment = source.getCommentsBefore(arg).pop();
if (!comment || comment.type != 'Block' ||
!comment.value.includes('=')) {
const filter = (c) => c.type == 'Block' && !c.value.includes('@');
const beforeComments = source.getCommentsBefore(arg).filter(filter);
if (beforeComments.length > 1) {
ctx.report({
node: beforeComments[0],
message: 'Multiple comments around arguments',
});
continue;
}
const afterComments = source.getCommentsAfter(arg).filter(filter);
if (afterComments.length > 0) {
ctx.report({
node: afterComments[0],
message: 'Argument comment should appear before argument',
fix: (fixer) => {
return [
fixer.remove(afterComments[0]),
fixer.insertTextBefore(
arg, '/*' + afterComments[0].value + '*/ '),
];
},
});
continue;
}
const comment = beforeComments.pop();
if (!comment) {
continue;
}
+1 -1
View File
@@ -679,7 +679,7 @@ function main(args) {
const results = inputPaths.map((path) => generateExterns(names, path));
// Sort them in dependency order.
const sorted = topologicalSort(results, /* getDeps */ (object) => {
const sorted = topologicalSort(results, /* getDeps= */ (object) => {
return object.requires.map((id) => {
const dep = results.find((x) => x.provides.includes(id));
assert(dep, 'Cannot find dependency: ' + id);
+2 -2
View File
@@ -113,7 +113,7 @@ shaka.abr.SimpleAbrManager = class {
shaka.log.warning('No variants met the ABR restrictions. ' +
'Choosing a variant by lowest bandwidth.');
sortedVariants = SimpleAbrManager.filterAndSortVariants_(
/* restrictions */ null, this.variants_);
/* restrictions= */ null, this.variants_);
sortedVariants = [sortedVariants[0]];
}
@@ -263,7 +263,7 @@ shaka.abr.SimpleAbrManager = class {
return shaka.util.StreamUtils.meetsRestrictions(
variant, restrictions,
/* maxHwRes */ {width: Infinity, height: Infinity});
/* maxHwRes= */ {width: Infinity, height: Infinity});
});
}
+1 -1
View File
@@ -580,7 +580,7 @@ shaka.cast.CastReceiver = class extends shaka.util.FakeEventTarget {
// Replies must go back to the specific sender who initiated, so that we
// don't have to deal with conflicting IDs between senders.
p.then(
() => this.sendAsyncComplete_(senderId, id, /* error */ null),
() => this.sendAsyncComplete_(senderId, id, /* error= */ null),
(error) => this.sendAsyncComplete_(senderId, id, error));
break;
}
+1 -1
View File
@@ -236,7 +236,7 @@ shaka.dash.ContentProtection = class {
const view = shaka.util.BufferUtils.toDataView(data);
// First 4 bytes is the PRO length (DWORD)
const byteLength = view.getUint32(byteOffset, true /* littleEndian */);
const byteLength = view.getUint32(byteOffset, /* littleEndian= */ true);
byteOffset += 4;
if (byteLength != data.byteLength) {
+4 -4
View File
@@ -338,8 +338,8 @@ shaka.dash.SegmentTemplate = class {
periodStart + segmentStart,
periodStart + segmentEnd,
getUris,
/* startByte */ 0,
/* endByte */ null,
/* startByte= */ 0,
/* endByte= */ null,
initSegmentReference,
timestampOffset,
appendWindowStart,
@@ -431,8 +431,8 @@ shaka.dash.SegmentTemplate = class {
periodStart + start,
periodStart + end,
createUris,
/* startByte */ 0,
/* endByte */ null,
/* startByte= */ 0,
/* endByte= */ null,
initSegmentReference,
timestampOffset,
appendWindowStart,
+13 -13
View File
@@ -430,7 +430,7 @@ shaka.hls.HlsParser = class {
// period-aligned times, so offset them all now.
streamInfo.stream.segmentIndex.offset(-minFirstTimestamp);
// Finally, fit the segments to the playlist duration.
streamInfo.stream.segmentIndex.fit(/* periodStart */ 0, minDuration);
streamInfo.stream.segmentIndex.fit(/* periodStart= */ 0, minDuration);
}
}
@@ -1006,7 +1006,7 @@ shaka.hls.HlsParser = class {
// descriptions: https://bit.ly/2lpjOhj
const streamInfo = await this.createStreamInfo_(
verbatimMediaPlaylistUri, codecs, type, language, primary, name,
channelsCount, /* closedCaptions */ null);
channelsCount, /* closedCaptions= */ null);
if (streamInfo == null) {
return null;
}
@@ -1046,8 +1046,8 @@ shaka.hls.HlsParser = class {
const closedCaptions = this.getClosedCaptions_(tag, type);
const codecs = this.guessCodecs_(type, allCodecs);
const streamInfo = await this.createStreamInfo_(verbatimMediaPlaylistUri,
codecs, type, /* language */ 'und', /* primary */ false,
/* name */ null, /* channelcount */ null, closedCaptions);
codecs, type, /* language= */ 'und', /* primary= */ false,
/* name= */ null, /* channelcount= */ null, closedCaptions);
if (streamInfo == null) {
return null;
}
@@ -1285,11 +1285,11 @@ shaka.hls.HlsParser = class {
// delay of 3 segments. This will be the "live edge" of the
// presentation.
this.presentationTimeline_ = new shaka.media.PresentationTimeline(
/* presentationStartTime */ 0, /* delay */ this.maxTargetDuration_ * 3);
/* presentationStartTime= */ 0, /* delay= */ this.maxTargetDuration_ * 3);
this.presentationTimeline_.setStatic(false);
} else {
this.presentationTimeline_ = new shaka.media.PresentationTimeline(
/* presentationStartTime */ null, /* delay */ 0);
/* presentationStartTime= */ null, /* delay= */ 0);
this.presentationTimeline_.setStatic(true);
}
@@ -1398,9 +1398,9 @@ shaka.hls.HlsParser = class {
startByte,
endByte,
initSegmentReference,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity);
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity);
}
/** @private */
@@ -1443,10 +1443,10 @@ shaka.hls.HlsParser = class {
const firstSegmentUri = hlsSegments[0].absoluteUri;
const firstSegmentRef = this.createSegmentReference_(
initSegmentRef,
/* previousReference */ null,
/* previousReference= */ null,
hlsSegments[0],
startPosition,
/* startTime, dummy value */ 0);
/* startTime= */ 0);
const firstStartTime = await this.getPlaylistStartTime_(
verbatimMediaPlaylistUri, initSegmentRef, firstSegmentRef, type,
@@ -1704,7 +1704,7 @@ shaka.hls.HlsParser = class {
timescale = box.reader.readUint32();
box.parser.stop();
}).parse(initData, true /* partialOkay */);
}).parse(initData, /* partialOkay= */ true);
if (!timescale) {
shaka.log.error('Unable to find timescale in init segment!');
@@ -1729,7 +1729,7 @@ shaka.hls.HlsParser = class {
startTime = baseTime / timescale;
parsedMedia = true;
box.parser.stop();
}).parse(mediaData, true /* partialOkay */);
}).parse(mediaData, /* partialOkay= */ true);
if (!parsedMedia) {
throw new shaka.util.Error(
+7 -7
View File
@@ -1227,7 +1227,7 @@ shaka.media.DrmEngine = class {
// </PlayReadyKeyMessage>
const xml = shaka.util.StringUtils.fromUTF16(
request.body, true /* littleEndian */, true /* noThrow */);
request.body, /* littleEndian= */ true, /* noThrow= */ true);
if (!xml.includes('PlayReadyKeyMessage')) {
// This does not appear to be a wrapped message as on IE and Edge. Some
// clients do not need this unwrapping, so we will assume this is one of
@@ -1296,13 +1296,13 @@ shaka.media.DrmEngine = class {
!shaka.util.Platform.isTizen()) {
// Read out some fields in little-endian:
const dataView = shaka.util.BufferUtils.toDataView(keyId);
const part0 = dataView.getUint32(0, true /* LE */);
const part1 = dataView.getUint16(4, true /* LE */);
const part2 = dataView.getUint16(6, true /* LE */);
const part0 = dataView.getUint32(0, /* LE= */ true);
const part1 = dataView.getUint16(4, /* LE= */ true);
const part2 = dataView.getUint16(6, /* LE= */ true);
// Write it back in big-endian:
dataView.setUint32(0, part0, false /* BE */);
dataView.setUint16(4, part1, false /* BE */);
dataView.setUint16(6, part2, false /* BE */);
dataView.setUint32(0, part0, /* BE= */ false);
dataView.setUint16(4, part1, /* BE= */ false);
dataView.setUint16(6, part2, /* BE= */ false);
}
// Microsoft's implementation in IE11 seems to never set key status to
+1 -1
View File
@@ -404,7 +404,7 @@ shaka.media.PresentationTimeline = class {
* @export
*/
getSeekRangeStart() {
return this.getSafeSeekRangeStart(/* offset */ 0);
return this.getSafeSeekRangeStart(/* offset= */ 0);
}
+11 -11
View File
@@ -284,7 +284,7 @@ shaka.media.SegmentIndex = class {
new shaka.media.SegmentReference(
lastReference.position,
lastReference.startTime,
/* endTime */ periodEnd,
/* endTime= */ periodEnd,
lastReference.getUris,
lastReference.startByte,
lastReference.endByte,
@@ -329,16 +329,16 @@ shaka.media.SegmentIndex = class {
*/
static forSingleSegment(startTime, duration, uris) {
const reference = new shaka.media.SegmentReference(
/* position */ 1,
/* startTime */ startTime,
/* endTime */ startTime + duration,
/* getUris */ () => uris,
/* startByte */ 0,
/* endByte */ null,
/* initSegmentReference */ null,
/* presentationTimeOffset */ startTime,
/* appendWindowStart */ startTime,
/* appendWindowEnd */ startTime + duration);
/* position= */ 1,
/* startTime= */ startTime,
/* endTime= */ startTime + duration,
/* getUris= */ () => uris,
/* startByte= */ 0,
/* endByte= */ null,
/* initSegmentReference= */ null,
/* presentationTimeOffset= */ startTime,
/* appendWindowStart= */ startTime,
/* appendWindowEnd= */ startTime + duration);
return new shaka.media.SegmentIndex([reference]);
}
};
+5 -5
View File
@@ -340,7 +340,7 @@ shaka.media.StreamingEngine = class {
streamMap.set(ContentType.TEXT, stream);
streamSet.add(stream);
await mediaSourceEngine.init(streamMap, /** forceTansmuxTS */ false);
await mediaSourceEngine.init(streamMap, /* forceTansmuxTS= */ false);
this.destroyer_.ensureNotDestroyed();
const textDisplayer =
@@ -573,7 +573,7 @@ shaka.media.StreamingEngine = class {
// Cancel the update timer, if any.
this.cancelUpdate_(mediaState);
// Clear right away.
this.clearBuffer_(mediaState, /* flush */ true, safeMargin)
this.clearBuffer_(mediaState, /* flush= */ true, safeMargin)
.catch((error) => {
if (this.playerInterface_) {
this.playerInterface_.onError(error);
@@ -800,7 +800,7 @@ shaka.media.StreamingEngine = class {
// buffer right away. Note: clearBuffer_() will schedule the next update.
shaka.log.debug(logPrefix, 'clear: handling right now');
this.cancelUpdate_(mediaState);
this.clearBuffer_(mediaState, /* flush */ false, 0).catch((error) => {
this.clearBuffer_(mediaState, /* flush= */ false, 0).catch((error) => {
if (this.playerInterface_) {
this.playerInterface_.onError(error);
}
@@ -1617,8 +1617,8 @@ shaka.media.StreamingEngine = class {
const hasClosedCaptions = mediaState.stream.closedCaptions &&
mediaState.stream.closedCaptions.size > 0;
await this.playerInterface_.mediaSourceEngine.appendBuffer(
mediaState.type, initSegment, null /* startTime */,
null /* endTime */, hasClosedCaptions);
mediaState.type, initSegment, /* startTime= */ null,
/* endTime= */ null, hasClosedCaptions);
} catch (error) {
mediaState.needInitSegment = true;
mediaState.lastInitSegmentReference = null;
+2 -2
View File
@@ -225,7 +225,7 @@ shaka.media.WebmSegmentIndexParser = class {
lastTime + timestampOffset,
currentTime + timestampOffset,
getUris,
/* startByte */ lastOffset, /* endByte */ currentOffset - 1,
/* startByte= */ lastOffset, /* endByte= */ currentOffset - 1,
initSegmentReference,
timestampOffset,
appendWindowStart,
@@ -245,7 +245,7 @@ shaka.media.WebmSegmentIndexParser = class {
lastTime + timestampOffset,
duration + timestampOffset,
getUris,
/* startByte */ lastOffset, /* endByte */ null,
/* startByte= */ lastOffset, /* endByte= */ null,
initSegmentReference,
timestampOffset,
appendWindowStart,
+2 -2
View File
@@ -353,10 +353,10 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
*/
makeRequestWithRetry_(type, request, numBytesRemainingObj) {
const backoff = new shaka.net.Backoff(
request.retryParameters, /* autoReset */ false);
request.retryParameters, /* autoReset= */ false);
const index = 0;
return this.send_(
type, request, backoff, index, /* lastError */ null,
type, request, backoff, index, /* lastError= */ null,
numBytesRemainingObj);
}
+6 -6
View File
@@ -259,12 +259,12 @@ shaka.offline.ManifestConverter = class {
periodStart + segmentDB.startTime,
periodStart + segmentDB.endTime,
() => [uri.toString()],
/* startByte */ 0,
/* endByte */ null,
/* startByte= */ 0,
/* endByte= */ null,
initSegmentReference,
timestampOffset,
/* appendWindowStart */ periodStart,
/* appendWindowEnd */ periodStart + periodDuration);
/* appendWindowStart= */ periodStart,
/* appendWindowEnd= */ periodStart + periodDuration);
}
/**
@@ -279,8 +279,8 @@ shaka.offline.ManifestConverter = class {
return new shaka.media.InitSegmentReference(
() => [uri.toString()],
0 /* startBytes*/,
null /* endBytes */);
/* startBytes= */ 0,
/* endBytes= */ null );
}
/**
+6 -6
View File
@@ -193,7 +193,7 @@ shaka.offline.Storage = class {
goog.asserts.assert(
this.config_, 'Cannot reconfigure stroage after calling destroy.');
return shaka.util.PlayerConfiguration.mergeConfigObjects(
this.config_ /* destination */, config /* updates */);
/* destination= */ this.config_, /* updates= */ config );
}
/**
@@ -497,7 +497,7 @@ shaka.offline.Storage = class {
'Cannot call |downloadManifest_| after calling |destroy|.');
const pendingContent = shaka.offline.StoredContentUtils.fromManifest(
uri, manifest, /* size */ 0, metadata);
uri, manifest, /* size= */ 0, metadata);
const isEncrypted = manifest.periods.some((period) => {
return period.variants.some((variant) => {
@@ -1058,7 +1058,7 @@ shaka.offline.Storage = class {
downloadGroup,
request,
estimator.getInitSegmentEstimate(stream.id),
/* isInitSegment */ true,
/* isInitSegment= */ true,
async (data) => {
const ids = await storage.addSegments([{data: data}]);
this.segmentsFromStore_.push(ids[0]);
@@ -1077,7 +1077,7 @@ shaka.offline.Storage = class {
downloadGroup,
request,
estimator.getSegmentEstimate(stream.id, segment),
/* isInitSegment */ false,
/* isInitSegment= */ false,
async (data) => {
const ids = await storage.addSegments([{data: data}]);
this.segmentsFromStore_.push(ids[0]);
@@ -1234,10 +1234,10 @@ shaka.offline.Storage = class {
serverCertificate: manifestDb.drmInfo.serverCertificate,
audioCapabilities: shaka.offline.Storage.getCapabilities_(
manifestDb,
/* isVideo */ false),
/* isVideo= */ false),
videoCapabilities: shaka.offline.Storage.getCapabilities_(
manifestDb,
/* isVideo */ true),
/* isVideo= */ true),
};
});
// Try to delete the sessions; any sessions that weren't deleted get stored
+9 -8
View File
@@ -1480,7 +1480,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
// This will be needed by the parser once it starts parsing, so we will
// initialize it now even through it appears a little out-of-place.
this.regionTimeline_ = new shaka.media.RegionTimeline();
this.regionTimeline_.setListeners(/* onRegionAdded */ (region) => {
this.regionTimeline_.setListeners(/* onRegionAdded= */ (region) => {
this.onRegionEvent_('timelineregionadded', region);
});
@@ -3523,9 +3523,9 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
originalId: null,
createSegmentIndex: () => Promise.resolve(),
segmentIndex: shaka.media.SegmentIndex.forSingleSegment(
/* startTime */ period.startTime,
/* duration */ periodDuration,
/* uris */ [uri]),
/* startTime= */ period.startTime,
/* duration= */ periodDuration,
/* uris= */ [uri]),
mimeType: mime,
codecs: codec || '',
kind: kind,
@@ -4182,8 +4182,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
// the switch methods not to through separate onAdaptation events,
// so UI doesn't update twice in a row. Switch everything, then throw
// a single event from this method with onAdaptation_().
this.chooseVariantAndSwitch_(period, /* fireAdaptationEvent */ false);
this.chooseTextAndSwitch_(period, /* fireAdaptationEvent */ false);
this.chooseVariantAndSwitch_(period, /* fireAdaptationEvent= */ false);
this.chooseTextAndSwitch_(period, /* fireAdaptationEvent= */ false);
this.onAdaptation_();
}
@@ -4206,7 +4206,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
if (chosenVariant) {
this.addVariantToSwitchHistory_(
period, chosenVariant, /* fromAdaptation= */ true);
this.switchVariant_(chosenVariant, /* clearBuffers */ true);
this.switchVariant_(chosenVariant, /* clearBuffers= */ true);
}
if (fireAdaptationEvent) {
@@ -4472,7 +4472,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
const period = this.findPeriodWithVariant_(variant);
goog.asserts.assert(period, 'A period should contain the variant.');
this.addVariantToSwitchHistory_(period, variant, /* fromAdaptation */ true);
this.addVariantToSwitchHistory_(
period, variant, /* fromAdaptation= */ true);
if (!this.streamingEngine_) {
// There's no way to change it.
+1 -1
View File
@@ -35,7 +35,7 @@ shaka.polyfill.MediaSource = class {
shaka.polyfill.MediaSource.patchCastIsTypeSupported_();
} else if (shaka.util.Platform.isApple()) {
const match = navigator.appVersion.match(/Version\/(\d+)/);
const version = parseInt(match[1], /* base */ 10);
const version = parseInt(match[1], /* base= */ 10);
// TS content is broken on Safari in general.
// See https://github.com/google/shaka-player/issues/743
+1 -1
View File
@@ -63,7 +63,7 @@ shaka.text.Mp4TtmlParser = class {
// mdats.
payload = payload.concat(this.parser_.parseMedia(data, time));
}));
parser.parse(data, /* partialOkay */ false);
parser.parse(data, /* partialOkay= */ false);
if (!sawMDAT) {
throw new shaka.util.Error(
+2 -2
View File
@@ -149,7 +149,7 @@ shaka.text.Mp4VttParser = class {
sawMDAT = true;
rawPayload = data;
}));
parser.parse(data, /* partialOkay */ false);
parser.parse(data, /* partialOkay= */ false);
if (!sawMDAT && !sawTFDT && !sawTRUN) {
// A required box is missing.
@@ -384,7 +384,7 @@ shaka.text.Mp4VttParser = class {
while (word) {
// TODO: Check WebVTTConfigurationBox for region info.
if (!shaka.text.VttTextParser.parseCueSetting(
cue, word, /* VTTRegions */[])) {
cue, word, /* VTTRegions= */[])) {
shaka.log.warning(
'VTT parser encountered an invalid VTT setting: ', word,
' The setting will be ignored.');
+1 -1
View File
@@ -315,7 +315,7 @@ shaka.text.TtmlTextParser = class {
regionElements,
cueRegions,
whitespaceTrim,
/* isNested */ true
/* isNested= */ true
);
if (nestedCue) {
+5 -4
View File
@@ -110,9 +110,10 @@ shaka.util.StringUtils = class {
if (uint8[0] == 0xef && uint8[1] == 0xbb && uint8[2] == 0xbf) {
return StringUtils.fromUTF8(uint8);
} else if (uint8[0] == 0xfe && uint8[1] == 0xff) {
return StringUtils.fromUTF16(uint8.subarray(2), false /* littleEndian */);
return StringUtils.fromUTF16(
uint8.subarray(2), /* littleEndian= */ false);
} else if (uint8[0] == 0xff && uint8[1] == 0xfe) {
return StringUtils.fromUTF16(uint8.subarray(2), true /* littleEndian */);
return StringUtils.fromUTF16(uint8.subarray(2), /* littleEndian= */ true);
}
const isAscii = (i) => {
@@ -123,9 +124,9 @@ shaka.util.StringUtils = class {
shaka.log.debug(
'Unable to find byte-order-mark, making an educated guess.');
if (uint8[0] == 0 && uint8[2] == 0) {
return StringUtils.fromUTF16(data, false /* littleEndian */);
return StringUtils.fromUTF16(data, /* littleEndian= */ false);
} else if (uint8[1] == 0 && uint8[3] == 0) {
return StringUtils.fromUTF16(data, true /* littleEndian */);
return StringUtils.fromUTF16(data, /* littleEndian= */ true);
} else if (isAscii(0) && isAscii(1) && isAscii(2) && isAscii(3)) {
return StringUtils.fromUTF8(data);
}
+3 -2
View File
@@ -222,11 +222,12 @@ describe('CastUtils', () => {
await mediaSourceEngine.init(initObject, false);
const data = await shaka.test.Util.fetch(initSegmentUrl);
await mediaSourceEngine.appendBuffer(
ContentType.VIDEO, data, null, null, /* hasClosedCaptions */ false);
ContentType.VIDEO, data, null, null,
/* hasClosedCaptions= */ false);
const data2 = await shaka.test.Util.fetch(videoSegmentUrl);
await mediaSourceEngine.appendBuffer(
ContentType.VIDEO, data2, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
});
afterEach(async () => {
@@ -364,8 +364,8 @@ describe('DashParser ContentProtection', () => {
buildDrmInfo('com.microsoft.playready'),
buildDrmInfo('com.adobe.primetime'),
])));
await testDashParser(source, expected, /* callback */ undefined,
/* ignoreDrmInfo */ true);
await testDashParser(source, expected, /* callback= */ undefined,
/* ignoreDrmInfo= */ true);
});
it('parses key IDs when ignoreDrmInfo flag is set', async () => {
@@ -391,8 +391,8 @@ describe('DashParser ContentProtection', () => {
buildDrmInfo('com.microsoft.playready', keyIds),
buildDrmInfo('com.adobe.primetime', keyIds),
]);
await testDashParser(source, expected, /* callback */ undefined,
/* ignoreDrmInfo */ true);
await testDashParser(source, expected, /* callback= */ undefined,
/* ignoreDrmInfo= */ true);
});
it('inherits PSSH from generic CENC into all key systems', async () => {
+2 -2
View File
@@ -501,7 +501,7 @@ describe('DashParser Live', () => {
'<SegmentTemplate startNumber="1" media="s$Number$.mp4" duration="2" />',
];
// updateTime parameter sets @minimumUpdatePeriod in the manifest.
const manifestText = makeSimpleLiveManifestText(lines, /* updateTime */ 0);
const manifestText = makeSimpleLiveManifestText(lines, /* updateTime= */ 0);
/** @type {!jasmine.Spy} */
const tickAfter = updateTickSpy();
@@ -522,7 +522,7 @@ describe('DashParser Live', () => {
];
// updateTime parameter sets @minimumUpdatePeriod in the manifest.
const manifestText =
makeSimpleLiveManifestText(lines, /* updateTime */ null);
makeSimpleLiveManifestText(lines, /* updateTime= */ null);
/** @type {!jasmine.Spy} */
const tickAfter = updateTickSpy();
+10 -10
View File
@@ -313,16 +313,16 @@ describe('DashParser Manifest', () => {
await stream.createSegmentIndex();
expect(stream.segmentIndex.find(0)).toBe(1);
expect(stream.segmentIndex.get(1)).toEqual(new shaka.media.SegmentReference(
/* position */ 1,
/* startTime */ 0,
/* endTime */ 30,
/* getUris */ () => ['http://example.com/de.vtt'],
/* startByte */ 0,
/* endBytes */ null,
/* initSegmentReference */ null,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ 30));
/* position= */ 1,
/* startTime= */ 0,
/* endTime= */ 30,
/* getUris= */ () => ['http://example.com/de.vtt'],
/* startByte= */ 0,
/* endBytes= */ null,
/* initSegmentReference= */ null,
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ 30));
});
it('correctly parses closed captions with channels and languages',
+2 -2
View File
@@ -29,7 +29,7 @@ describe('DashParser SegmentList', () => {
' <S d="5" />',
' </SegmentTimeline>',
'</SegmentList>',
], 65 /* duration */);
], /* duration= */ 65);
const references = [
ManifestParser.makeReference('s1.mp4', 1, 50, 60, baseUri),
ManifestParser.makeReference('s2.mp4', 2, 60, 65, baseUri),
@@ -42,7 +42,7 @@ describe('DashParser SegmentList', () => {
'<SegmentList>',
' <SegmentURL media="s1.mp4" />',
'</SegmentList>',
], 30 /* duration */);
], /* duration= */ 30);
const references = [ManifestParser.makeReference('s1.mp4', 1,
0, 30, baseUri)];
await Dash.testSegmentIndex(source, references);
+10 -10
View File
@@ -52,7 +52,7 @@ describe('DashParser SegmentTemplate', () => {
const source = Dash.makeSimpleManifestText([
'<SegmentTemplate startNumber="1" media="s$Number$.mp4"',
' duration="10" />',
], 60 /* duration */);
], /* duration= */ 60);
const references = [
ManifestParser.makeReference('s1.mp4', 0, 0, 10, baseUri),
ManifestParser.makeReference('s2.mp4', 1, 10, 20, baseUri),
@@ -68,7 +68,7 @@ describe('DashParser SegmentTemplate', () => {
const source = Dash.makeSimpleManifestText([
'<SegmentTemplate startNumber="10" media="s$Number$.mp4"',
' duration="10" />',
], 30 /* duration */);
], /* duration= */ 30);
const references = [
ManifestParser.makeReference('s10.mp4', 0, 0, 10, baseUri),
ManifestParser.makeReference('s11.mp4', 1, 10, 20, baseUri),
@@ -81,7 +81,7 @@ describe('DashParser SegmentTemplate', () => {
const source = Dash.makeSimpleManifestText([
'<SegmentTemplate media="s$Number$.mp4" duration="10"',
' presentationTimeOffset="50" />',
], 30 /* duration */, 40 /* startTime */ );
], /* duration= */ 30, /* startTime= */ 40);
fakeNetEngine.setResponseText('dummy://foo', source);
const manifest = await parser.start('dummy://foo', playerInterface);
@@ -108,7 +108,7 @@ describe('DashParser SegmentTemplate', () => {
it('handles segments larger than the period', async () => {
const source = Dash.makeSimpleManifestText([
'<SegmentTemplate media="s$Number$.mp4" duration="60" />',
], 30 /* duration */);
], /* duration= */ 30);
// The first segment is number 1 and position 0.
// Although the segment is 60 seconds long, it is clipped to the period
// duration of 30 seconds.
@@ -121,7 +121,7 @@ describe('DashParser SegmentTemplate', () => {
it('presentation start is parsed correctly', async () => {
const source = Dash.makeSimpleManifestText([
'<SegmentTemplate media="s$Number$.mp4" duration="60" />',
], 30 /* duration */, /* startTime */ 30);
], /* duration= */ 30, /* startTime= */ 30);
fakeNetEngine.setResponseText('dummy://foo', source);
const manifest = await parser.start('dummy://foo', playerInterface);
@@ -293,7 +293,7 @@ describe('DashParser SegmentTemplate', () => {
' <S t="0" d="15" r="2" />',
' </SegmentTimeline>',
'</SegmentTemplate>',
], 45 /* duration */);
], /* duration= */ 45);
const references = [
ManifestParser.makeReference('0-0-500.mp4', 0, 0, 15, baseUri),
ManifestParser.makeReference('1-15-500.mp4', 1, 15, 30, baseUri),
@@ -306,7 +306,7 @@ describe('DashParser SegmentTemplate', () => {
const source = Dash.makeSimpleManifestText([
'<SegmentTemplate startNumber="0" duration="10"',
' media="$Number$-$Time$-$Bandwidth$.mp4" />',
], 30 /* duration */);
], /* duration= */ 30);
const references = [
ManifestParser.makeReference('0-0-500.mp4', 0, 0, 10, baseUri),
ManifestParser.makeReference('1-10-500.mp4', 1, 10, 20, baseUri),
@@ -319,7 +319,7 @@ describe('DashParser SegmentTemplate', () => {
const source = Dash.makeSimpleManifestText([
'<SegmentTemplate startNumber="1" duration="10"',
' media="$Number$-$Time$-$Bandwidth$.mp4" />',
], 30 /* duration */);
], /* duration= */ 30);
const references = [
ManifestParser.makeReference('1-0-500.mp4', 0, 0, 10, baseUri),
ManifestParser.makeReference('2-10-500.mp4', 1, 10, 20, baseUri),
@@ -332,7 +332,7 @@ describe('DashParser SegmentTemplate', () => {
const source = Dash.makeSimpleManifestText([
'<SegmentTemplate startNumber="10" duration="10"',
' media="$Number$-$Time$-$Bandwidth$.mp4" />',
], 30 /* duration */);
], /* duration= */ 30);
const references = [
ManifestParser.makeReference('10-0-500.mp4', 0, 0, 10, baseUri),
ManifestParser.makeReference('11-10-500.mp4', 1, 10, 20, baseUri),
@@ -345,7 +345,7 @@ describe('DashParser SegmentTemplate', () => {
const source = Dash.makeSimpleManifestText([
'<SegmentTemplate startNumber="1" timescale="9000" duration="9000"',
' media="$Number$-$Time$-$Bandwidth$.mp4" />',
], 3 /* duration */);
], /* duration= */ 3);
const references = [
ManifestParser.makeReference('1-0-500.mp4', 0, 0, 1, baseUri),
ManifestParser.makeReference('2-9000-500.mp4', 1, 1, 2, baseUri),
+5 -5
View File
@@ -643,11 +643,11 @@ describe('HlsParser live', () => {
.setResponseValue('test:/main.mp4', segmentData);
const expectedRef = ManifestParser.makeReference(
'test:/main.mp4' /* uri */,
0 /* position */,
segmentDataStartTime /* start */,
segmentDataStartTime + 2 /* end */,
'' /* baseUri */,
/* uri= */ 'test:/main.mp4',
/* position= */ 0,
/* start= */ segmentDataStartTime,
/* end= */ segmentDataStartTime + 2,
/* baseUri= */ '',
expectedStartByte,
expectedEndByte); // Complete segment reference
+10 -10
View File
@@ -2030,11 +2030,11 @@ describe('HlsParser', () => {
.setResponseValue('test:/main.mp4', segmentData);
const expectedRef = ManifestParser.makeReference(
'test:/main.mp4' /* uri */,
0 /* position */,
0 /* startTime */,
5 /* endTime */,
'' /* baseUri */,
/* uri= */ 'test:/main.mp4',
/* position= */ 0,
/* startTime= */ 0,
/* endTime= */ 5,
/* baseUri= */ '',
expectedStartByte,
expectedEndByte);
// In VOD content, we set the timestampOffset to align the
@@ -2063,11 +2063,11 @@ describe('HlsParser', () => {
.setResponseValue('test:/main.ts', tsSegmentData);
const expectedRef = ManifestParser.makeReference(
'test:/main.ts' /* uri */,
0 /* position */,
0 /* startTime */,
5 /* endTime */,
'' /* baseUri */,
/* uri= */ 'test:/main.ts',
/* position= */ 0,
/* startTime= */ 0,
/* endTime= */ 5,
/* baseUri= */ '',
expectedStartByte,
expectedEndByte);
// In VOD content, we set the timestampOffset to align the
+26 -26
View File
@@ -30,7 +30,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-TARGETDURATION', [], '6'),
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-TARGETDURATION', [], '6'),
],
},
@@ -47,8 +47,8 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-TARGETDURATION', [], '6'),
new shaka.hls.Tag(/* id */ 1, 'EXT-X-STREAM-INF',
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-TARGETDURATION', [], '6'),
new shaka.hls.Tag(/* id= */ 1, 'EXT-X-STREAM-INF',
[
new shaka.hls.Attribute('BANDWIDTH', '2165224'),
new shaka.hls.Attribute('URI', 'prog_index.m3u8'),
@@ -71,7 +71,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-TARGETDURATION', [], '6'),
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-TARGETDURATION', [], '6'),
],
},
@@ -94,7 +94,7 @@ describe('ManifestTextParser', () => {
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.MANIFEST,
code));
expect(() => parser.parsePlaylist(data, /* uri */ '')).toThrow(error);
expect(() => parser.parsePlaylist(data, /* uri= */ '')).toThrow(error);
}
});
@@ -104,7 +104,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MASTER,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-INDEPENDENT-SEGMENTS', []),
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-INDEPENDENT-SEGMENTS', []),
],
},
@@ -119,7 +119,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 1, 'EXT-X-PLAYLIST-TYPE', [], 'VOD'),
new shaka.hls.Tag(/* id= */ 1, 'EXT-X-PLAYLIST-TYPE', [], 'VOD'),
],
},
@@ -134,7 +134,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 2, 'EXT-X-MEDIA-SEQUENCE', [], '1'),
new shaka.hls.Tag(/* id= */ 2, 'EXT-X-MEDIA-SEQUENCE', [], '1'),
],
},
@@ -151,7 +151,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MASTER,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-MEDIA',
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-MEDIA',
[new shaka.hls.Attribute('TYPE', 'CLOSED-CAPTIONS')]),
],
},
@@ -167,7 +167,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MASTER,
tags: [
new shaka.hls.Tag(/* id */ 1, 'EXT-X-MEDIA',
new shaka.hls.Tag(/* id= */ 1, 'EXT-X-MEDIA',
[
new shaka.hls.Attribute('URI', 'main.mp4'),
new shaka.hls.Attribute('BYTERANGE', '720@0'),
@@ -188,7 +188,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MASTER,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-MEDIA',
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-MEDIA',
[
new shaka.hls.Attribute('CODECS', 'avc1.64002a,mp4a.40.2'),
]),
@@ -206,7 +206,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MASTER,
tags: [
new shaka.hls.Tag(/* id */ 1, 'EXT-X-MEDIA',
new shaka.hls.Tag(/* id= */ 1, 'EXT-X-MEDIA',
[
new shaka.hls.Attribute('CODECS',
'avc1.64002a,mp4a.40.2,avc2.64000'),
@@ -225,7 +225,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MASTER,
tags: [
new shaka.hls.Tag(/* id */ 2, 'EXT-X-MEDIA',
new shaka.hls.Tag(/* id= */ 2, 'EXT-X-MEDIA',
[
new shaka.hls.Attribute('CODECS',
'avc1.64002a,mp4a.40.2'),
@@ -249,7 +249,7 @@ describe('ManifestTextParser', () => {
shaka.util.Error.Code.INVALID_HLS_TAG,
'invalid tag'));
const text = shaka.util.StringUtils.toUTF8('#EXTM3U\ninvalid tag');
expect(() => parser.parsePlaylist(text, /* uri */ '')).toThrow(error);
expect(() => parser.parsePlaylist(text, /* uri= */ '')).toThrow(error);
});
});
@@ -285,12 +285,12 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-MEDIA-SEQUENCE', [], '1'),
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-MEDIA-SEQUENCE', [], '1'),
],
segments: [
new shaka.hls.Segment('https://test/test.mp4',
[
new shaka.hls.Tag(/* id */ 2, 'EXTINF', [], '5.99467'),
new shaka.hls.Tag(/* id= */ 2, 'EXTINF', [], '5.99467'),
]),
],
},
@@ -310,13 +310,13 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-MEDIA-SEQUENCE', [], '1'),
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-MEDIA-SEQUENCE', [], '1'),
],
segments: [
new shaka.hls.Segment('https://test/test.mp4',
[
new shaka.hls.Tag(
/* id */ 2,
/* id= */ 2,
'EXTINF',
[new shaka.hls.Attribute('pid', '180')],
'5.99467'
@@ -340,18 +340,18 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 2, 'EXT-X-TARGETDURATION', [], '6'),
new shaka.hls.Tag(/* id= */ 2, 'EXT-X-TARGETDURATION', [], '6'),
],
segments: [
new shaka.hls.Segment('https://test/test.mp4',
[
new shaka.hls.Tag(/* id */ 1, 'EXT-X-KEY',
new shaka.hls.Tag(/* id= */ 1, 'EXT-X-KEY',
[
new shaka.hls.Attribute('METHOD', 'AES-128'),
new shaka.hls.Attribute('URI', 'http://key.com'),
new shaka.hls.Attribute('IV', '123'),
]),
new shaka.hls.Tag(/* id */ 3, 'EXTINF', [], '5.99467'),
new shaka.hls.Tag(/* id= */ 3, 'EXTINF', [], '5.99467'),
]),
],
},
@@ -373,12 +373,12 @@ describe('ManifestTextParser', () => {
absoluteUri: 'https://test/manifest.m3u8',
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-MEDIA-SEQUENCE', [], '1'),
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-MEDIA-SEQUENCE', [], '1'),
],
segments: [
new shaka.hls.Segment('https://test/test.mp4',
[
new shaka.hls.Tag(/* id */ 2, 'EXTINF', [], '5.99467'),
new shaka.hls.Tag(/* id= */ 2, 'EXTINF', [], '5.99467'),
]),
],
},
@@ -407,7 +407,7 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-TARGETDURATION', [], '6'),
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-TARGETDURATION', [], '6'),
],
segments: [
new shaka.hls.Segment('https://test/uri',
@@ -428,8 +428,8 @@ describe('ManifestTextParser', () => {
{
type: shaka.hls.PlaylistType.MEDIA,
tags: [
new shaka.hls.Tag(/* id */ 0, 'EXT-X-TARGETDURATION', [], '6'),
new shaka.hls.Tag(/* id */ 4, 'EXT-X-ENDLIST', []),
new shaka.hls.Tag(/* id= */ 0, 'EXT-X-TARGETDURATION', [], '6'),
new shaka.hls.Tag(/* id= */ 4, 'EXT-X-ENDLIST', []),
],
segments: [
new shaka.hls.Segment('https://test/uri',
+4 -4
View File
@@ -198,10 +198,10 @@ describe('DrmEngine', () => {
await drmEngine.attach(video);
await mediaSourceEngine.appendBuffer(
ContentType.VIDEO, videoInitSegment, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
await mediaSourceEngine.appendBuffer(
ContentType.AUDIO, audioInitSegment, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
await encryptedEventSeen;
// With PlayReady, a persistent license policy can cause a different
// chain of events. In particular, the request is bypassed and we
@@ -235,10 +235,10 @@ describe('DrmEngine', () => {
await mediaSourceEngine.appendBuffer(
ContentType.VIDEO, videoSegment, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
await mediaSourceEngine.appendBuffer(
ContentType.AUDIO, audioSegment, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
expect(video.buffered.end(0)).toBeGreaterThan(0);
video.play();
+1 -1
View File
@@ -417,7 +417,7 @@ describe('DrmEngine', () => {
const variants = Periods.getAllVariantsFrom(manifest.periods);
await expectAsync(
drmEngine.initForStorage(variants, /* usePersistentLicense */ true))
drmEngine.initForStorage(variants, /* usePersistentLicense= */ true))
.toBeRejected();
expect(drmEngine.initialized()).toBe(false);
+17 -17
View File
@@ -61,22 +61,22 @@ describe('MediaSourceEngine', () => {
function appendInit(type) {
const segment = generators[type].getInitSegment(Date.now() / 1000);
return mediaSourceEngine.appendBuffer(
type, segment, null, null, /* hasClosedCaptions */ false);
type, segment, null, null, /* hasClosedCaptions= */ false);
}
function append(type, segmentNumber) {
const segment = generators[type]
.getSegment(segmentNumber, 0, Date.now() / 1000);
return mediaSourceEngine.appendBuffer(
type, segment, null, null, /* hasClosedCaptions */ false);
type, segment, null, null, /* hasClosedCaptions= */ false);
}
// The start time and end time should be null for init segment with closed
// captions.
function appendInitWithClosedCaptions(type) {
const segment = generators[type].getInitSegment(Date.now() / 1000);
return mediaSourceEngine.appendBuffer(type, segment, /* startTime */ null,
/* endTime */ null, /* hasClosedCaptions */ true);
return mediaSourceEngine.appendBuffer(type, segment, /* startTime= */ null,
/* endTime= */ null, /* hasClosedCaptions= */ true);
}
// The start time and end time should be valid for the segments with closed
@@ -84,8 +84,8 @@ describe('MediaSourceEngine', () => {
function appendWithClosedCaptions(type, segmentNumber) {
const segment = generators[type]
.getSegment(segmentNumber, 0, Date.now() / 1000);
return mediaSourceEngine.appendBuffer(type, segment, /* startTime */ 0,
/* endTime */ 2, /* hasClosedCaptions */ true);
return mediaSourceEngine.appendBuffer(type, segment, /* startTime= */ 0,
/* endTime= */ 2, /* hasClosedCaptions= */ true);
}
function buffered(type, time) {
@@ -289,9 +289,9 @@ describe('MediaSourceEngine', () => {
await mediaSourceEngine.setDuration(presentationDuration);
await appendInit(ContentType.VIDEO);
await mediaSourceEngine.setStreamProperties(ContentType.VIDEO,
/* timestampOffset */ 0,
/* appendWindowStart */ 5,
/* appendWindowEnd */ 18);
/* timestampOffset= */ 0,
/* appendWindowStart= */ 5,
/* appendWindowEnd= */ 18);
expect(buffered(ContentType.VIDEO, 0)).toBe(0);
await append(ContentType.VIDEO, 1);
expect(bufferStart(ContentType.VIDEO)).toBeCloseTo(5, 1);
@@ -308,9 +308,9 @@ describe('MediaSourceEngine', () => {
await appendInit(ContentType.VIDEO);
// Simulate period 1, with 20 seconds of content, no timestamp offset
await mediaSourceEngine.setStreamProperties(ContentType.VIDEO,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ 20);
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ 20);
await append(ContentType.VIDEO, 1);
await append(ContentType.VIDEO, 2);
expect(bufferStart(ContentType.VIDEO)).toBeCloseTo(0, 1);
@@ -320,9 +320,9 @@ describe('MediaSourceEngine', () => {
// The 5 seconds of overlap should be trimmed off, and we should still
// have a continuous stream with 35 seconds of content.
await mediaSourceEngine.setStreamProperties(ContentType.VIDEO,
/* timestampOffset */ 15,
/* appendWindowStart */ 20,
/* appendWindowEnd */ 35);
/* timestampOffset= */ 15,
/* appendWindowStart= */ 20,
/* appendWindowEnd= */ 35);
await append(ContentType.VIDEO, 1);
await append(ContentType.VIDEO, 2);
expect(bufferStart(ContentType.VIDEO)).toBeCloseTo(0, 1);
@@ -339,7 +339,7 @@ describe('MediaSourceEngine', () => {
initObject.set(ContentType.TEXT, getFakeStream(metadata.text));
// Call with forceTransmuxTS = true, so that it will transmux even on
// platforms with native TS support.
await mediaSourceEngine.init(initObject, /** forceTransmuxTS */ true);
await mediaSourceEngine.init(initObject, /* forceTransmuxTS= */ true);
mediaSourceEngine.setSelectedClosedCaptionId('CC1');
await append(ContentType.VIDEO, 0);
@@ -354,7 +354,7 @@ describe('MediaSourceEngine', () => {
const initObject = new Map();
initObject.set(ContentType.VIDEO, getFakeStream(metadata.video));
await mediaSourceEngine.init(initObject, /** forceTransmuxTS */ false);
await mediaSourceEngine.init(initObject, /* forceTransmuxTS= */ false);
await mediaSourceEngine.setDuration(presentationDuration);
await appendInitWithClosedCaptions(ContentType.VIDEO);
mediaSourceEngine.setSelectedClosedCaptionId('CC1');
+45 -39
View File
@@ -339,7 +339,8 @@ describe('MediaSourceEngine', () => {
it('appends the given data', async () => {
const p = mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null, /* hasClosedCaptions */ false);
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions= */ false);
expect(audioSourceBuffer.appendBuffer).toHaveBeenCalledWith(buffer);
audioSourceBuffer.updateend();
await p;
@@ -356,7 +357,7 @@ describe('MediaSourceEngine', () => {
await expectAsync(
mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false))
/* hasClosedCaptions= */ false))
.toBeRejectedWith(expected);
expect(audioSourceBuffer.appendBuffer).toHaveBeenCalledWith(buffer);
});
@@ -375,7 +376,7 @@ describe('MediaSourceEngine', () => {
await expectAsync(
mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false))
/* hasClosedCaptions= */ false))
.toBeRejectedWith(expected);
expect(audioSourceBuffer.appendBuffer).toHaveBeenCalledWith(buffer);
});
@@ -396,10 +397,10 @@ describe('MediaSourceEngine', () => {
const p1 = mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
const p2 = mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
audioSourceBuffer.updateend();
await expectAsync(p1).toBeResolved();
await expectAsync(p2).toBeRejectedWith(expected);
@@ -408,7 +409,8 @@ describe('MediaSourceEngine', () => {
it('rejects the promise if this operation fails async', async () => {
mockVideo.error = {code: 5};
const p = mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null, /* hasClosedCaptions */ false);
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions= */ false);
audioSourceBuffer.error();
audioSourceBuffer.updateend();
@@ -425,11 +427,11 @@ describe('MediaSourceEngine', () => {
/** @type {!shaka.test.StatusPromise} */
const p1 = new shaka.test.StatusPromise(mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false));
/* hasClosedCaptions= */ false));
/** @type {!shaka.test.StatusPromise} */
const p2 = new shaka.test.StatusPromise(mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer2, null, null,
/* hasClosedCaptions */ false));
/* hasClosedCaptions= */ false));
expect(audioSourceBuffer.appendBuffer).toHaveBeenCalledWith(buffer);
expect(audioSourceBuffer.appendBuffer).not.toHaveBeenCalledWith(buffer2);
@@ -448,15 +450,15 @@ describe('MediaSourceEngine', () => {
/** @type {!shaka.test.StatusPromise} */
const p1 = new shaka.test.StatusPromise(mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false));
/* hasClosedCaptions= */ false));
/** @type {!shaka.test.StatusPromise} */
const p2 = new shaka.test.StatusPromise(mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer2, null, null,
/* hasClosedCaptions */ false));
/* hasClosedCaptions= */ false));
/** @type {!shaka.test.StatusPromise} */
const p3 = new shaka.test.StatusPromise(mediaSourceEngine.appendBuffer(
ContentType.VIDEO, buffer3, null, null,
/* hasClosedCaptions */ false));
/* hasClosedCaptions= */ false));
expect(audioSourceBuffer.appendBuffer).toHaveBeenCalledWith(buffer);
expect(audioSourceBuffer.appendBuffer).not.toHaveBeenCalledWith(buffer2);
@@ -490,13 +492,14 @@ describe('MediaSourceEngine', () => {
});
const p1 = mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null, /* hasClosedCaptions */ false);
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions= */ false);
const p2 = mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer2, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
const p3 = mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer3, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
await expectAsync(p1).toBeResolved();
await expectAsync(p2).toBeRejected();
@@ -510,7 +513,7 @@ describe('MediaSourceEngine', () => {
const data = new ArrayBuffer(0);
expect(mockTextEngine.appendBuffer).not.toHaveBeenCalled();
await mediaSourceEngine.appendBuffer(
ContentType.TEXT, data, 0, 10, /* hasClosedCaptions */ false);
ContentType.TEXT, data, 0, 10, /* hasClosedCaptions= */ false);
expect(mockTextEngine.appendBuffer).toHaveBeenCalledWith(
data, 0, 10);
});
@@ -529,7 +532,7 @@ describe('MediaSourceEngine', () => {
await mediaSourceEngine.init(initObject, false);
await mediaSourceEngine.appendBuffer(
ContentType.VIDEO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
expect(mockTextEngine.storeAndAppendClosedCaptions).toHaveBeenCalled();
expect(videoSourceBuffer.appendBuffer).toHaveBeenCalled();
};
@@ -559,7 +562,7 @@ describe('MediaSourceEngine', () => {
await mediaSourceEngine.init(initObject, false);
await mediaSourceEngine.appendBuffer(
ContentType.VIDEO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
expect(mockTextEngine.appendCues).not.toHaveBeenCalled();
expect(mockTextEngine.storeAndAppendClosedCaptions)
.not.toHaveBeenCalled();
@@ -829,9 +832,9 @@ describe('MediaSourceEngine', () => {
expect(mockTextEngine.setTimestampOffset).not.toHaveBeenCalled();
expect(mockTextEngine.setAppendWindow).not.toHaveBeenCalled();
await mediaSourceEngine.setStreamProperties(ContentType.TEXT,
/* timestampOffset */ 10,
/* appendWindowStart */ 0,
/* appendWindowEnd */ 20);
/* timestampOffset= */ 10,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ 20);
expect(mockTextEngine.setTimestampOffset).toHaveBeenCalledWith(10);
expect(mockTextEngine.setAppendWindow).toHaveBeenCalledWith(0, 20);
});
@@ -856,11 +859,11 @@ describe('MediaSourceEngine', () => {
/** @type {!shaka.test.StatusPromise} */
const p1 = new shaka.test.StatusPromise(mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false));
/* hasClosedCaptions= */ false));
/** @type {!shaka.test.StatusPromise} */
const p2 = new shaka.test.StatusPromise(mediaSourceEngine.appendBuffer(
ContentType.VIDEO, buffer, null, null,
/* hasClosedCaptions */ false));
/* hasClosedCaptions= */ false));
/** @type {!shaka.test.StatusPromise} */
const p3 = new shaka.test.StatusPromise(mediaSourceEngine.endOfStream());
@@ -883,11 +886,11 @@ describe('MediaSourceEngine', () => {
/** @type {!Promise} */
const p1 = mediaSourceEngine.endOfStream();
mediaSourceEngine.appendBuffer(ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
mediaSourceEngine.appendBuffer(ContentType.VIDEO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
mediaSourceEngine.appendBuffer(ContentType.VIDEO, buffer2, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
// endOfStream hasn't been called yet because blocking multiple queues
// takes an extra tick, even when they are empty.
@@ -915,7 +918,7 @@ describe('MediaSourceEngine', () => {
/** @type {!Promise} */
const p1 = mediaSourceEngine.endOfStream();
mediaSourceEngine.appendBuffer(ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
expect(audioSourceBuffer.appendBuffer).not.toHaveBeenCalled();
@@ -947,11 +950,11 @@ describe('MediaSourceEngine', () => {
/** @type {!shaka.test.StatusPromise} */
const p1 = new shaka.test.StatusPromise(mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false));
/* hasClosedCaptions= */ false));
/** @type {!shaka.test.StatusPromise} */
const p2 = new shaka.test.StatusPromise(mediaSourceEngine.appendBuffer(
ContentType.VIDEO, buffer, null, null,
/* hasClosedCaptions */ false));
/* hasClosedCaptions= */ false));
/** @type {!shaka.test.StatusPromise} */
const p3 =
new shaka.test.StatusPromise(mediaSourceEngine.setDuration(100));
@@ -975,11 +978,11 @@ describe('MediaSourceEngine', () => {
/** @type {!Promise} */
const p1 = mediaSourceEngine.setDuration(100);
mediaSourceEngine.appendBuffer(ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
mediaSourceEngine.appendBuffer(ContentType.VIDEO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
mediaSourceEngine.appendBuffer(ContentType.VIDEO, buffer2, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
// The setter hasn't been called yet because blocking multiple queues
// takes an extra tick, even when they are empty.
@@ -1008,7 +1011,7 @@ describe('MediaSourceEngine', () => {
/** @type {!Promise} */
const p1 = mediaSourceEngine.setDuration(100);
mediaSourceEngine.appendBuffer(ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
expect(audioSourceBuffer.appendBuffer).not.toHaveBeenCalled();
@@ -1032,9 +1035,9 @@ describe('MediaSourceEngine', () => {
it('waits for all operations to complete', async () => {
mediaSourceEngine.appendBuffer(ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
mediaSourceEngine.appendBuffer(ContentType.VIDEO, buffer, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
/** @type {!shaka.test.StatusPromise} */
const d = new shaka.test.StatusPromise(mediaSourceEngine.destroy());
@@ -1051,7 +1054,8 @@ describe('MediaSourceEngine', () => {
it('resolves even when a pending operation fails', async () => {
const p = mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null, /* hasClosedCaptions */ false);
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions= */ false);
const d = mediaSourceEngine.destroy();
audioSourceBuffer.error();
@@ -1075,10 +1079,11 @@ describe('MediaSourceEngine', () => {
it('cancels operations that have not yet started', async () => {
mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null, /* hasClosedCaptions */ false);
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions= */ false);
const rejected = mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer2, null, null,
/* hasClosedCaptions */ false);
/* hasClosedCaptions= */ false);
// Create the expectation first so we don't get unhandled rejection errors
const expected = expectAsync(rejected).toBeRejected();
@@ -1101,7 +1106,8 @@ describe('MediaSourceEngine', () => {
it('cancels blocking operations that have not yet started', async () => {
const p1 = mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null, /* hasClosedCaptions */ false);
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions= */ false);
const p2 = mediaSourceEngine.endOfStream();
const d = mediaSourceEngine.destroy();
@@ -1116,7 +1122,7 @@ describe('MediaSourceEngine', () => {
await expectAsync(
mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null, null,
/* hasClosedCaptions */ false))
/* hasClosedCaptions= */ false))
.toBeRejected();
await d;
expect(audioSourceBuffer.appendBuffer).not.toHaveBeenCalled();
+18 -18
View File
@@ -29,23 +29,23 @@ describe('Mp4SegmentIndexParser', () => {
expect(() => shaka.media.Mp4SegmentIndexParser.parse(
mediaSegment,
/* sidxOffset */ 0,
/* uris */ [],
/* initSegmentReference */ null,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity)).toThrow(error);
/* sidxOffset= */ 0,
/* uris= */ [],
/* initSegmentReference= */ null,
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity)).toThrow(error);
});
it('parses index segment ', () => {
const result = shaka.media.Mp4SegmentIndexParser.parse(
indexSegment,
/* sidxOffset */ 0,
/* uris */ [],
/* initSegmentReference */ null,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity);
/* sidxOffset= */ 0,
/* uris= */ [],
/* initSegmentReference= */ null,
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity);
const references = [
{startTime: 0, endTime: 12, startByte: 92, endByte: 194960},
{startTime: 12, endTime: 24, startByte: 194961, endByte: 294059},
@@ -60,12 +60,12 @@ describe('Mp4SegmentIndexParser', () => {
it('takes a timestamp offset in seconds', () => {
const result = shaka.media.Mp4SegmentIndexParser.parse(
indexSegment,
/* sidxOffset */ 0,
/* uris */ [],
/* initSegmentReference */ null,
/* timestampOffset */ -2,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity);
/* sidxOffset= */ 0,
/* uris= */ [],
/* initSegmentReference= */ null,
/* timestampOffset= */ -2,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity);
const references = [
{startTime: -2, endTime: 10},
{startTime: 10, endTime: 22},
+20 -20
View File
@@ -162,7 +162,7 @@ describe('Playhead', () => {
video,
manifest,
config,
5 /* startTime */,
/* startTime= */ 5,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -183,7 +183,7 @@ describe('Playhead', () => {
video,
manifest,
config,
5 /* startTime */,
/* startTime= */ 5,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -224,7 +224,7 @@ describe('Playhead', () => {
video,
manifest,
config,
5 /* startTime */,
/* startTime= */ 5,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -244,7 +244,7 @@ describe('Playhead', () => {
timeline.getSeekRangeEnd.and.returnValue(60);
playhead = new shaka.media.MediaSourcePlayhead(
video, manifest, config, 0 /* startTime */, Util.spyFunc(onSeek),
video, manifest, config, /* startTime= */ 0, Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
expect(playhead.getTime()).toBe(0);
@@ -258,7 +258,7 @@ describe('Playhead', () => {
timeline.getDuration.and.returnValue(60);
playhead = new shaka.media.MediaSourcePlayhead(
video, manifest, config, 60 /* startTime */, Util.spyFunc(onSeek),
video, manifest, config, /* startTime= */ 60, Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
expect(playhead.getTime()).toBe(59); // duration - durationBackoff
@@ -273,7 +273,7 @@ describe('Playhead', () => {
timeline.getSeekRangeEnd.and.returnValue(60);
playhead = new shaka.media.MediaSourcePlayhead(
video, manifest, config, -15 /* startTime */, Util.spyFunc(onSeek),
video, manifest, config, /* startTime= */ -15, Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
expect(playhead.getTime()).toBe(45);
@@ -288,7 +288,7 @@ describe('Playhead', () => {
// If the live stream's playback offset time is not available, start
// playing from the seek range start time.
playhead = new shaka.media.MediaSourcePlayhead(
video, manifest, config, -40 /* startTime */, Util.spyFunc(onSeek),
video, manifest, config, /* startTime= */ -40, Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
expect(playhead.getTime()).toBe(30);
@@ -299,7 +299,7 @@ describe('Playhead', () => {
video,
manifest,
config,
5 /* startTime */,
/* startTime= */ 5,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -332,7 +332,7 @@ describe('Playhead', () => {
video,
manifest,
config,
null /* startTime */,
/* startTime= */ null,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -365,7 +365,7 @@ describe('Playhead', () => {
video,
manifest,
config,
5 /* startTime */,
/* startTime= */ 5,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -525,7 +525,7 @@ describe('Playhead', () => {
video,
manifest,
config,
5 /* startTime */,
/* startTime= */ 5,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -574,7 +574,7 @@ describe('Playhead', () => {
video,
manifest,
config,
5 /* startTime */,
/* startTime= */ 5,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -635,7 +635,7 @@ describe('Playhead', () => {
video,
manifest,
config,
5 /* startTime */,
/* startTime= */ 5,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
expect(currentTime).toBe(1000);
@@ -681,7 +681,7 @@ describe('Playhead', () => {
video,
manifest,
config,
5 /* startTime */,
/* startTime= */ 5,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -713,7 +713,7 @@ describe('Playhead', () => {
video,
manifest,
config,
5 /* startTime */,
/* startTime= */ 5,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -748,7 +748,7 @@ describe('Playhead', () => {
video,
manifest,
config,
30 /* startTime, middle of the seek range */,
/* startTime= */ 30,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -893,7 +893,7 @@ describe('Playhead', () => {
video,
manifest,
config,
data.start /* startTime */,
/* startTime= */ data.start,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -1146,7 +1146,7 @@ describe('Playhead', () => {
video,
manifest,
config,
12 /* startTime */,
/* startTime= */ 12,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -1195,7 +1195,7 @@ describe('Playhead', () => {
video,
manifest,
config,
0 /* startTime */,
/* startTime= */ 0,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
@@ -1227,7 +1227,7 @@ describe('Playhead', () => {
video,
manifest,
config,
data.start /* startTime */,
/* startTime= */ data.start,
Util.spyFunc(onSeek),
Util.spyFunc(onEvent));
+43 -42
View File
@@ -64,9 +64,9 @@ describe('PresentationTimeline', () => {
*/
function makeVodTimeline(duration) {
const timeline = makePresentationTimeline(
/* static */ true, duration, /* start time */ null,
/* availability */ Infinity, /* max seg dur */ 10,
/* clock offset */ 0, /* presentation delay */ 0);
/* static= */ true, duration, /* start= */ null,
/* availability= */ Infinity, /* max= */ 10,
/* clock= */ 0, /* presentation= */ 0);
expect(timeline.isLive()).toBe(false);
expect(timeline.isInProgress()).toBe(false);
return timeline;
@@ -82,9 +82,9 @@ describe('PresentationTimeline', () => {
function makeIprTimeline(duration, delay) {
const now = Date.now() / 1000;
const timeline = makePresentationTimeline(
/* static */ false, duration, /* start time */ now,
/* availability */ Infinity, /* max seg dur */ 10,
/* clock offset */ 0, delay || 0);
/* static= */ false, duration, /* start= */ now,
/* availability= */ Infinity, /* max= */ 10,
/* clock= */ 0, delay || 0);
expect(timeline.isLive()).toBe(false);
expect(timeline.isInProgress()).toBe(true);
return timeline;
@@ -101,9 +101,9 @@ describe('PresentationTimeline', () => {
function makeLiveTimeline(availability, delay, autoCorrectDrift = true) {
const now = Date.now() / 1000;
const timeline = makePresentationTimeline(
/* static */ false, /* duration */ Infinity, /* start time */ now,
availability, /* max seg dur */ 10,
/* clock offset */ 0, delay || 0, autoCorrectDrift);
/* static= */ false, /* duration= */ Infinity, /* start= */ now,
availability, /* max= */ 10,
/* clock= */ 0, delay || 0, autoCorrectDrift);
expect(timeline.isLive()).toBe(true);
expect(timeline.isInProgress()).toBe(false);
return timeline;
@@ -119,22 +119,22 @@ describe('PresentationTimeline', () => {
// start and end times are the only fields that matter to
// PresentationTimeline.
return new shaka.media.SegmentReference(
/* position */ 0,
/* position= */ 0,
startTime,
endTime,
/* uris */ () => [],
/* startByte */ 0,
/* endByte */ null,
/* initSegmentReference */ null,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity);
/* uris= */ () => [],
/* startByte= */ 0,
/* endByte= */ null,
/* initSegmentReference= */ null,
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity);
}
describe('getSegmentAvailabilityStart', () => {
it('returns 0 for VOD and IPR', () => {
const timeline1 = makeVodTimeline(/* duration */ 60);
const timeline2 = makeIprTimeline(/* duration */ 60);
const timeline1 = makeVodTimeline(/* duration= */ 60);
const timeline2 = makeIprTimeline(/* duration= */ 60);
setElapsed(0);
expect(timeline1.getSegmentAvailabilityStart()).toBe(0);
@@ -146,7 +146,7 @@ describe('PresentationTimeline', () => {
});
it('calculates time for live with finite availability', () => {
const timeline = makeLiveTimeline(/* availability */ 20);
const timeline = makeLiveTimeline(/* availability= */ 20);
setElapsed(0);
expect(timeline.getSegmentAvailabilityStart()).toBe(0);
@@ -171,7 +171,7 @@ describe('PresentationTimeline', () => {
});
it('calculates time for live with infinite availability', () => {
const timeline = makeLiveTimeline(/* availability */ Infinity);
const timeline = makeLiveTimeline(/* availability= */ Infinity);
setElapsed(0);
expect(timeline.getSegmentAvailabilityStart()).toBe(0);
@@ -187,7 +187,7 @@ describe('PresentationTimeline', () => {
});
it('calculates time based on segment times when available', () => {
const timeline = makeLiveTimeline(/* availability */ 20);
const timeline = makeLiveTimeline(/* availability= */ 20);
const ref1 = makeSegmentReference(0, 10);
const ref2 = makeSegmentReference(10, 20);
@@ -207,7 +207,8 @@ describe('PresentationTimeline', () => {
it('ignores segment times when configured to', () => {
const timeline = makeLiveTimeline(
/* availability */ 20, /* drift */ 0, /* autoCorrectDrift */ false);
/* availability= */ 20, /* drift= */ 0,
/* autoCorrectDrift= */ false);
const ref1 = makeSegmentReference(0, 10);
const ref2 = makeSegmentReference(10, 20);
@@ -225,7 +226,7 @@ describe('PresentationTimeline', () => {
describe('getSegmentAvailabilityEnd', () => {
it('returns duration for VOD', () => {
const timeline = makeVodTimeline(/* duration */ 60);
const timeline = makeVodTimeline(/* duration= */ 60);
setElapsed(0);
expect(timeline.getSegmentAvailabilityEnd()).toBe(60);
@@ -235,7 +236,7 @@ describe('PresentationTimeline', () => {
});
it('calculates time for IPR', () => {
const timeline = makeIprTimeline(/* duration */ 60);
const timeline = makeIprTimeline(/* duration= */ 60);
setElapsed(0);
expect(timeline.getSegmentAvailabilityEnd()).toBe(0);
@@ -257,8 +258,8 @@ describe('PresentationTimeline', () => {
});
it('calculates time for live', () => {
const timeline1 = makeLiveTimeline(/* availability */ 20);
const timeline2 = makeLiveTimeline(/* availability */ Infinity);
const timeline1 = makeLiveTimeline(/* availability= */ 20);
const timeline2 = makeLiveTimeline(/* availability= */ Infinity);
setElapsed(0);
expect(timeline1.getSegmentAvailabilityEnd()).toBe(0);
@@ -286,7 +287,7 @@ describe('PresentationTimeline', () => {
});
it('calculates time based on segment times when available', () => {
const timeline = makeLiveTimeline(/* availability */ 20);
const timeline = makeLiveTimeline(/* availability= */ 20);
const ref1 = makeSegmentReference(0, 10);
const ref2 = makeSegmentReference(10, 20);
@@ -308,10 +309,10 @@ describe('PresentationTimeline', () => {
describe('getDuration', () => {
it('returns the timeline duration', () => {
setElapsed(0);
const timeline1 = makeVodTimeline(/* duration */ 60);
const timeline2 = makeIprTimeline(/* duration */ 60);
const timeline3 = makeLiveTimeline(/* availability */ 20);
const timeline4 = makeLiveTimeline(/* availability */ Infinity);
const timeline1 = makeVodTimeline(/* duration= */ 60);
const timeline2 = makeIprTimeline(/* duration= */ 60);
const timeline3 = makeLiveTimeline(/* availability= */ 20);
const timeline4 = makeLiveTimeline(/* availability= */ Infinity);
expect(timeline1.getDuration()).toBe(60);
expect(timeline2.getDuration()).toBe(60);
expect(timeline3.getDuration()).toBe(Infinity);
@@ -322,7 +323,7 @@ describe('PresentationTimeline', () => {
describe('setDuration', () => {
it('affects availability end for VOD', () => {
setElapsed(0);
const timeline = makeVodTimeline(/* duration */ 60);
const timeline = makeVodTimeline(/* duration= */ 60);
expect(timeline.getSegmentAvailabilityEnd()).toBe(60);
timeline.setDuration(90);
@@ -330,7 +331,7 @@ describe('PresentationTimeline', () => {
});
it('affects availability end for IPR', () => {
const timeline = makeIprTimeline(/* duration */ 60);
const timeline = makeIprTimeline(/* duration= */ 60);
setElapsed(85);
expect(timeline.getSegmentAvailabilityEnd()).toBe(60);
@@ -342,25 +343,25 @@ describe('PresentationTimeline', () => {
describe('clockOffset', () => {
it('offsets availability calculations', () => {
const timeline = makeLiveTimeline(/* availability */ 10);
const timeline = makeLiveTimeline(/* availability= */ 10);
setElapsed(11);
expect(timeline.getSegmentAvailabilityEnd()).toBe(1);
timeline.setClockOffset(5000 /* ms */);
timeline.setClockOffset(/* ms= */ 5000);
expect(timeline.getSegmentAvailabilityEnd()).toBe(6);
});
});
describe('getSafeSeekRangeStart', () => {
it('ignores offset for VOD', () => {
const timeline = makeVodTimeline(/* duration */ 60);
const timeline = makeVodTimeline(/* duration= */ 60);
expect(timeline.getSafeSeekRangeStart(0)).toBe(0);
expect(timeline.getSafeSeekRangeStart(10)).toBe(0);
expect(timeline.getSafeSeekRangeStart(25)).toBe(0);
});
it('offsets from live edge', () => {
const timeline = makeLiveTimeline(/* availability */ 60, /* delay */ 0);
const timeline = makeLiveTimeline(/* availability= */ 60, /* delay= */ 0);
setElapsed(120);
// now (120) - availability (60) - segment size (10) = 50
@@ -371,7 +372,7 @@ describe('PresentationTimeline', () => {
});
it('clamps to end', () => {
const timeline = makeLiveTimeline(/* availability */ 60, /* delay */ 0);
const timeline = makeLiveTimeline(/* availability= */ 60, /* delay= */ 0);
setElapsed(120);
expect(timeline.getSegmentAvailabilityEnd()).toBe(110);
@@ -381,7 +382,7 @@ describe('PresentationTimeline', () => {
});
it('will return 0 if safe', () => {
const timeline = makeLiveTimeline(/* availability */ 60, /* delay */ 0);
const timeline = makeLiveTimeline(/* availability= */ 60, /* delay= */ 0);
setElapsed(50);
// now (50) - availability (60) - segment size (10) = -20
@@ -393,8 +394,8 @@ describe('PresentationTimeline', () => {
describe('getSeekRangeEnd', () => {
it('accounts for delay for live and IPR', () => {
const timeline1 = makeIprTimeline(/* duration */ 60, /* delay */ 7);
const timeline2 = makeLiveTimeline(/* duration */ 60, /* delay */ 7);
const timeline1 = makeIprTimeline(/* duration= */ 60, /* delay= */ 7);
const timeline2 = makeLiveTimeline(/* duration= */ 60, /* delay= */ 7);
setElapsed(11);
expect(timeline1.getSeekRangeEnd()).toBe(0);
+8 -8
View File
@@ -58,7 +58,7 @@ describe('RegionObserver', () => {
// Make sure we call |onEnter| when we enter the region.
poll(observer,
/* timeInSeconds= */ 7,
/* seeking */ false);
/* seeking= */ false);
expect(onEnterRegion).toHaveBeenCalledOnceMoreWith([region, false]);
});
@@ -69,7 +69,7 @@ describe('RegionObserver', () => {
// Make sure we call |onEnter| when we enter the region.
poll(observer,
/* timeInSeconds= */ 7,
/* seeking */ false);
/* seeking= */ false);
expect(onEnterRegion).toHaveBeenCalledOnceMoreWith([region, false]);
poll(observer,
@@ -90,12 +90,12 @@ describe('RegionObserver', () => {
// Move into the region (we must be in the region to leave it).
poll(observer,
/* timeInSeconds= */ 7,
/* seeking */ false);
/* seeking= */ false);
// Make sure we call |onExit| when we exit the region.
poll(observer,
/* timeInSeconds= */ 15,
/* seeking */ false);
/* seeking= */ false);
expect(onExitRegion).toHaveBeenCalledOnceMoreWith([region, false]);
});
@@ -106,14 +106,14 @@ describe('RegionObserver', () => {
// Make sure we are before the region starts.
poll(observer,
/* timeInSeconds= */ 4,
/* seeking */ false);
/* seeking= */ false);
expect(onSkipRegion).not.toHaveBeenCalled();
// Make sure we call |onSkip| when we move so far that we skip over the
// region.
poll(observer,
/* timeInSeconds= */ 15,
/* seeking */ false);
/* seeking= */ false);
expect(onSkipRegion).toHaveBeenCalledOnceMoreWith([region, false]);
});
@@ -125,14 +125,14 @@ describe('RegionObserver', () => {
// Make sure we are before the region starts.
poll(observer,
/* timeInSeconds= */ 4,
/* seeking */ false);
/* seeking= */ false);
expect(onSkipRegion).not.toHaveBeenCalled();
// Make sure we call |onSkip| when we move so far that we skip over the
// region.
poll(observer,
/* timeInSeconds= */ 10,
/* seeking */ false);
/* seeking= */ false);
expect(onSkipRegion).toHaveBeenCalledOnceMoreWith([region, false]);
});
+9 -9
View File
@@ -151,7 +151,7 @@ describe('SegmentIndex', /** @suppress {accessControls} */ () => {
const index = new shaka.media.SegmentIndex(references);
expect(index.references_).toEqual(references);
index.fit(/* periodStart */ 0, /* periodEnd */ 15);
index.fit(/* periodStart= */ 0, /* periodEnd= */ 15);
const newReferences = [
/* ref 0 dropped because it ends before the period starts */
makeReference(1, -3, 4, uri(1)),
@@ -172,7 +172,7 @@ describe('SegmentIndex', /** @suppress {accessControls} */ () => {
const index = new shaka.media.SegmentIndex(references);
expect(index.references_).toEqual(references);
index.fit(/* periodStart */ 0, /* periodEnd */ 10);
index.fit(/* periodStart= */ 0, /* periodEnd= */ 10);
const newReferences = [
/* ref 0 dropped because it ends before the period starts (at 0) */
makeReference(1, 0, 10, uri(1)),
@@ -373,13 +373,13 @@ describe('SegmentIndex', /** @suppress {accessControls} */ () => {
function makeReference(position, startTime, endTime, uri) {
return new shaka.media.SegmentReference(
position, startTime, endTime,
/* getUris */ () => [uri],
/* startByte */ 0,
/* endByte */ null,
/* initSegmentReference */ null,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity);
/* getUris= */ () => [uri],
/* startByte= */ 0,
/* endByte= */ null,
/* initSegmentReference= */ null,
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity);
}
/**
+15 -15
View File
@@ -6,21 +6,21 @@
describe('SegmentReference', () => {
it('returns in getters values from constructor parameters', () => {
const initSegmentReference = new shaka.media.InitSegmentReference(
/* getUris */ () => ['a', 'b'],
/* startByte */ 0,
/* endBytes */ null);
/* getUris= */ () => ['a', 'b'],
/* startByte= */ 0,
/* endBytes= */ null);
const reference = new shaka.media.SegmentReference(
/* position */ 1,
/* startTime */ 2,
/* endTime */ 3,
/* getUris */ () => ['x', 'y'],
/* startByte */ 4,
/* endByte */ 5,
/* position= */ 1,
/* startTime= */ 2,
/* endTime= */ 3,
/* getUris= */ () => ['x', 'y'],
/* startByte= */ 4,
/* endByte= */ 5,
initSegmentReference,
/* timestampOffset */ 6,
/* appendWindowStart */ 7,
/* appendWindowEnd */ 8);
/* timestampOffset= */ 6,
/* appendWindowStart= */ 7,
/* appendWindowEnd= */ 8);
expect(reference.getPosition()).toBe(1);
expect(reference.getStartTime()).toBe(2);
@@ -38,9 +38,9 @@ describe('SegmentReference', () => {
describe('InitSegmentReference', () => {
it('returns in getters values from constructor parameters', () => {
const reference = new shaka.media.InitSegmentReference(
/* getUris */ () => ['x', 'y'],
/* startByte */ 4,
/* endByte */ 5);
/* getUris= */ () => ['x', 'y'],
/* startByte= */ 4,
/* endByte= */ 5);
expect(reference.getUris()).toEqual(['x', 'y']);
expect(reference.getStartByte()).toBe(4);
+50 -50
View File
@@ -93,23 +93,23 @@ describe('StreamingEngine', () => {
await createVodStreamGenerator(metadata.video, ContentType.VIDEO);
timeline = shaka.test.StreamingEngineUtil.createFakePresentationTimeline(
0 /* segmentAvailabilityStart */,
60 /* segmentAvailabilityEnd */,
60 /* presentationDuration */,
metadata.video.segmentDuration /* maxSegmentDuration */,
false /* isLive */);
/* segmentAvailabilityStart= */ 0,
/* segmentAvailabilityEnd= */ 60,
/* presentationDuration= */ 60,
/* maxSegmentDuration= */ metadata.video.segmentDuration,
/* isLive= */ false);
setupNetworkingEngine(
0 /* firstPeriodStartTime */,
30 /* secondPeriodStartTime */,
60 /* presentationDuration */,
/* firstPeriodStartTime= */ 0,
/* secondPeriodStartTime= */ 30,
/* presentationDuration= */ 60,
{audio: metadata.audio.segmentDuration,
video: metadata.video.segmentDuration});
setupManifest(
0 /* firstPeriodStartTime */,
30 /* secondPeriodStartTime */,
60 /* presentationDuration */);
/* firstPeriodStartTime= */ 0,
/* secondPeriodStartTime= */ 30,
/* presentationDuration= */ 60);
setupPlayhead();
@@ -120,34 +120,34 @@ describe('StreamingEngine', () => {
await createLiveStreamGenerator(
metadata.audio,
ContentType.AUDIO,
20 /* timeShiftBufferDepth */);
/* timeShiftBufferDepth= */ 20);
await createLiveStreamGenerator(
metadata.video,
ContentType.VIDEO,
20 /* timeShiftBufferDepth */);
/* timeShiftBufferDepth= */ 20);
// The generator's AST is set to 295 seconds in the past, so the live-edge
// is at 295 - 10 seconds.
// -10 to account for maxSegmentDuration.
timeline = shaka.test.StreamingEngineUtil.createFakePresentationTimeline(
275 - 10 /* segmentAvailabilityStart */,
295 - 10 /* segmentAvailabilityEnd */,
Infinity /* presentationDuration */,
metadata.video.segmentDuration /* maxSegmentDuration */,
true /* isLive */);
/* segmentAvailabilityStart= */ 275 - 10,
/* segmentAvailabilityEnd= */ 295 - 10,
/* presentationDuration= */ Infinity,
/* maxSegmentDuration= */ metadata.video.segmentDuration,
/* isLive= */ true);
setupNetworkingEngine(
0 /* firstPeriodStartTime */,
300 /* secondPeriodStartTime */,
Infinity /* presentationDuration */,
/* firstPeriodStartTime= */ 0,
/* secondPeriodStartTime= */ 300,
/* presentationDuration= */ Infinity,
{audio: metadata.audio.segmentDuration,
video: metadata.video.segmentDuration});
setupManifest(
0 /* firstPeriodStartTime */,
300 /* secondPeriodStartTime */,
Infinity /* presentationDuration */);
/* firstPeriodStartTime= */ 0,
/* secondPeriodStartTime= */ 300,
/* presentationDuration= */ Infinity);
setupPlayhead();
createStreamingEngine();
@@ -174,8 +174,8 @@ describe('StreamingEngine', () => {
metadata.segmentUri,
metadata.tfdtOffset,
metadata.segmentDuration,
now - 295 /* broadcastStartTime */,
now - 295 /* availabilityStartTime */,
/* broadcastStartTime= */ now - 295,
/* availabilityStartTime= */ now - 295,
timeShiftBufferDepth);
generators[type] = generator;
return generator.init();
@@ -237,7 +237,7 @@ describe('StreamingEngine', () => {
/** @type {!HTMLVideoElement} */(video),
manifest,
config,
null /* startTime */,
/* startTime= */ null,
onSeek,
shaka.test.Util.spyFunc(onEvent));
}
@@ -246,11 +246,11 @@ describe('StreamingEngine', () => {
firstPeriodStartTime, secondPeriodStartTime, presentationDuration) {
manifest = shaka.test.StreamingEngineUtil.createManifest(
[firstPeriodStartTime, secondPeriodStartTime], presentationDuration,
/* segmentDurations */ {
/* segmentDurations= */ {
audio: metadata.audio.segmentDuration,
video: metadata.video.segmentDuration,
},
/* initSegmentRanges */ {
/* initSegmentRanges= */ {
audio: [0, null],
video: [0, null],
});
@@ -443,7 +443,7 @@ describe('StreamingEngine', () => {
describe('gap jumping', () => {
it('jumps small gaps at the beginning', async () => {
config.smallGapLimit = 5;
await setupGappyContent(/* gapAtStart */ 1, /* dropSegment */ false);
await setupGappyContent(/* gapAtStart= */ 1, /* dropSegment= */ false);
onStartupComplete.and.callFake(() => {
expect(video.buffered.length).toBeGreaterThan(0);
expect(video.buffered.start(0)).toBeCloseTo(1);
@@ -460,7 +460,7 @@ describe('StreamingEngine', () => {
it('jumps large gaps at the beginning', async () => {
config.smallGapLimit = 1;
config.jumpLargeGaps = true;
await setupGappyContent(/* gapAtStart */ 5, /* dropSegment */ false);
await setupGappyContent(/* gapAtStart= */ 5, /* dropSegment= */ false);
onStartupComplete.and.callFake(() => {
expect(video.buffered.length).toBeGreaterThan(0);
expect(video.buffered.start(0)).toBeCloseTo(5);
@@ -476,7 +476,7 @@ describe('StreamingEngine', () => {
it('jumps small gaps in the middle', async () => {
config.smallGapLimit = 20;
await setupGappyContent(/* gapAtStart */ 0, /* dropSegment */ true);
await setupGappyContent(/* gapAtStart= */ 0, /* dropSegment= */ true);
onStartupComplete.and.callFake(() => {
video.currentTime = 8;
video.play();
@@ -493,7 +493,7 @@ describe('StreamingEngine', () => {
it('jumps large gaps in the middle', async () => {
config.jumpLargeGaps = true;
await setupGappyContent(/* gapAtStart */ 0, /* dropSegment */ true);
await setupGappyContent(/* gapAtStart= */ 0, /* dropSegment= */ true);
onStartupComplete.and.callFake(() => {
video.currentTime = 8;
video.play();
@@ -510,7 +510,7 @@ describe('StreamingEngine', () => {
it('won\'t jump large gaps with preventDefault()', async () => {
config.jumpLargeGaps = true;
await setupGappyContent(/* gapAtStart */ 0, /* dropSegment */ true);
await setupGappyContent(/* gapAtStart= */ 0, /* dropSegment= */ true);
onStartupComplete.and.callFake(() => {
video.currentTime = 8;
video.play();
@@ -545,16 +545,16 @@ describe('StreamingEngine', () => {
timeline =
shaka.test.StreamingEngineUtil.createFakePresentationTimeline(
0 /* segmentAvailabilityStart */,
30 /* segmentAvailabilityEnd */,
30 /* presentationDuration */,
metadata.video.segmentDuration /* maxSegmentDuration */,
false /* isLive */);
/* segmentAvailabilityStart= */ 0,
/* segmentAvailabilityEnd= */ 30,
/* presentationDuration= */ 30,
/* maxSegmentDuration= */ metadata.video.segmentDuration,
/* isLive= */ false);
setupNetworkingEngine(
0 /* firstPeriodStartTime */,
30 /* secondPeriodStartTime */,
30 /* presentationDuration */,
/* firstPeriodStartTime= */ 0,
/* secondPeriodStartTime= */ 30,
/* presentationDuration= */ 30,
{
audio: metadata.audio.segmentDuration,
video: metadata.video.segmentDuration,
@@ -602,16 +602,16 @@ describe('StreamingEngine', () => {
return ['1_' + type + '_' + cur];
};
refs.push(new shaka.media.SegmentReference(
/* position */ i,
/* startTime */ time,
/* endTime */ end,
/* position= */ i,
/* startTime= */ time,
/* endTime= */ end,
getUris,
/* startByte */ 0,
/* endByte */ null,
/* startByte= */ 0,
/* endByte= */ null,
initSegmentReference,
/* timestampOffset */ gapAtStart,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity));
/* timestampOffset= */ gapAtStart,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity));
i++;
time = end;
+25 -25
View File
@@ -176,20 +176,20 @@ describe('StreamingEngine', () => {
playing = false;
setupNetworkingEngine(
2 /* segmentsInFirstPeriod */,
2 /* segmentsInSecondPeriod */);
/* segmentsInFirstPeriod= */ 2,
/* segmentsInSecondPeriod= */ 2);
timeline = shaka.test.StreamingEngineUtil.createFakePresentationTimeline(
0 /* segmentAvailabilityStart */,
40 /* segmentAvailabilityEnd */,
40 /* presentationDuration */,
10 /* maxSegmentDuration */,
false /* isLive */);
/* segmentAvailabilityStart= */ 0,
/* segmentAvailabilityEnd= */ 40,
/* presentationDuration= */ 40,
/* maxSegmentDuration= */ 10,
/* isLive= */ false);
setupManifest(
0 /* firstPeriodStartTime */,
20 /* secondPeriodStartTime */,
40 /* presentationDuration */);
/* firstPeriodStartTime= */ 0,
/* secondPeriodStartTime= */ 20,
/* presentationDuration= */ 40);
}
function setupLive() {
@@ -285,8 +285,8 @@ describe('StreamingEngine', () => {
playing = false;
setupNetworkingEngine(
12 /* segmentsInFirstPeriod */,
2 /* segmentsInSecondPeriod */);
/* segmentsInFirstPeriod= */ 12,
/* segmentsInSecondPeriod= */ 2);
// NOTE: Many tests here start playback at 100, so the availability start is
// 90. This allows the async index creation processes to complete before
@@ -296,16 +296,16 @@ describe('StreamingEngine', () => {
// time to complete. To test actual boundary conditions, you can change
// timeline.segmentAvailabilityStart in the test setup.
timeline = shaka.test.StreamingEngineUtil.createFakePresentationTimeline(
90 /* segmentAvailabilityStart */,
140 /* segmentAvailabilityEnd */,
140 /* presentationDuration */,
10 /* maxSegmentDuration */,
true /* isLive */);
/* segmentAvailabilityStart= */ 90,
/* segmentAvailabilityEnd= */ 140,
/* presentationDuration= */ 140,
/* maxSegmentDuration= */ 10,
/* isLive= */ true);
setupManifest(
0 /* firstPeriodStartTime */,
120 /* secondPeriodStartTime */,
140 /* presentationDuration */);
/* firstPeriodStartTime= */ 0,
/* secondPeriodStartTime= */ 120,
/* presentationDuration= */ 140);
}
function setupNetworkingEngine(
@@ -1112,7 +1112,7 @@ describe('StreamingEngine', () => {
onCanSwitch.and.callFake(async () => {
mediaSourceEngine.clear.calls.reset();
streamingEngine.switchVariant(
sameAudioVariant, /* clearBuffer */ true, /* safeMargin */ 0);
sameAudioVariant, /* clearBuffer= */ true, /* safeMargin= */ 0);
await Util.fakeEventLoop(1);
expect(mediaSourceEngine.clear).not.toHaveBeenCalledWith('audio');
expect(mediaSourceEngine.clear).toHaveBeenCalledWith('video');
@@ -1120,7 +1120,7 @@ describe('StreamingEngine', () => {
mediaSourceEngine.clear.calls.reset();
streamingEngine.switchVariant(
sameVideoVariant, /* clearBuffer */ true, /* safeMargin */ 0);
sameVideoVariant, /* clearBuffer= */ true, /* safeMargin= */ 0);
await Util.fakeEventLoop(1);
expect(mediaSourceEngine.clear).toHaveBeenCalledWith('audio');
expect(mediaSourceEngine.clear).not.toHaveBeenCalledWith('video');
@@ -2604,7 +2604,7 @@ describe('StreamingEngine', () => {
describe('setTrickPlay', () => {
it('uses trick mode track when requested', async () => {
setupVod(/* trickMode */ true);
setupVod(/* trickMode= */ true);
mediaSourceEngine = new shaka.test.FakeMediaSourceEngine(segmentData);
const config = shaka.util.PlayerConfiguration.createDefault().streaming;
@@ -2952,8 +2952,8 @@ describe('StreamingEngine', () => {
return new shaka.media.SegmentReference(
seg.position, seg.startTime, seg.endTime, seg.getUris,
/* startByte= */ 0, /* endByte= */ null,
/* initSegmentReference */ null, /* timestampOffset */ 0,
/* appendWindowStart */ 0, /* appendWindowEnd */ Infinity);
/* initSegmentReference= */ null, /* timestampOffset= */ 0,
/* appendWindowStart= */ 0, /* appendWindowEnd= */ Infinity);
} else {
return seg;
}
+24 -24
View File
@@ -25,13 +25,13 @@ describe('WebmSegmentIndexParser', () => {
shaka.util.Error.Category.MEDIA,
shaka.util.Error.Code.WEBM_CUES_ELEMENT_MISSING));
expect(() => shaka.media.WebmSegmentIndexParser.parse(
/* indexSegment */ initSegment, // deliberate wrong data
/* initSegment */ initSegment,
/* uris */ [],
/* initSegmentReference */ null,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity)).toThrow(error);
/* indexSegment= */ initSegment, // deliberate wrong data
/* initSegment= */ initSegment,
/* uris= */ [],
/* initSegmentReference= */ null,
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity)).toThrow(error);
});
it('rejects an invalid init segment ', () => {
@@ -40,23 +40,23 @@ describe('WebmSegmentIndexParser', () => {
shaka.util.Error.Category.MEDIA,
shaka.util.Error.Code.WEBM_EBML_HEADER_ELEMENT_MISSING));
expect(() => shaka.media.WebmSegmentIndexParser.parse(
/* indexSegment */ indexSegment,
/* initSegment */ indexSegment, // deliberate wrong data
/* uris */ [],
/* initSegmentReference */ null,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity)).toThrow(error);
/* indexSegment= */ indexSegment,
/* initSegment= */ indexSegment, // deliberate wrong data
/* uris= */ [],
/* initSegmentReference= */ null,
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity)).toThrow(error);
});
it('parses index segment ', () => {
const result = shaka.media.WebmSegmentIndexParser.parse(
indexSegment, initSegment,
/* uris */ [],
/* initSegmentReference */ null,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity);
/* uris= */ [],
/* initSegmentReference= */ null,
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity);
const references = [
{startTime: 0, endTime: 12, startByte: 281, endByte: 95911},
{startTime: 12, endTime: 24, startByte: 95912, endByte: 209663},
@@ -71,11 +71,11 @@ describe('WebmSegmentIndexParser', () => {
it('takes a timestamp offset in seconds', () => {
const result = shaka.media.WebmSegmentIndexParser.parse(
indexSegment, initSegment,
/* uris */ [],
/* initSegmentReference */ null,
/* timestampOffset */ -2,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity);
/* uris= */ [],
/* initSegmentReference= */ null,
/* timestampOffset= */ -2,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity);
const references = [
{startTime: -2, endTime: 10},
{startTime: 10, endTime: 22},
+1 -1
View File
@@ -182,7 +182,7 @@ filterDescribe('IndexeddbStorageCell', () => window.indexedDB, () => {
connection,
segmentStore,
manifestStore,
false /* allow add operations */);
/* allow= */ false);
// Track the cell so that we can destroy it when the test is over.
cells.push(cell);
+33 -33
View File
@@ -24,8 +24,8 @@ describe('ManifestConverter', () => {
/** @type {!Map.<number, shaka.extern.Variant>} */
const variants = createConverter().createVariants(
audios, videos, timeline, /* periodStart */ 0,
/* periodDuration */ 10);
audios, videos, timeline, /* periodStart= */ 0,
/* periodDuration= */ 10);
expect(variants.size).toBe(2);
expect(variants.has(0)).toBeTruthy();
@@ -50,8 +50,8 @@ describe('ManifestConverter', () => {
/** @type {!Map.<number, shaka.extern.Variant>} */
const variants = createConverter().createVariants(
audios, videos, timeline, /* periodStart */ 0,
/* periodDuration */ 10);
audios, videos, timeline, /* periodStart= */ 0,
/* periodDuration= */ 10);
expect(variants.size).toBe(2);
});
@@ -68,8 +68,8 @@ describe('ManifestConverter', () => {
/** @type {!Map.<number, shaka.extern.Variant>} */
const variants = createConverter().createVariants(
audios, videos, timeline, /* periodStart */ 0,
/* periodDuration */ 10);
audios, videos, timeline, /* periodStart= */ 0,
/* periodDuration= */ 10);
expect(variants.size).toBe(2);
});
}); // describe('createVariants')
@@ -297,17 +297,17 @@ describe('ManifestConverter', () => {
keyId: 'key1',
segments: [
createSegmentDB(
/* start time */ periodStart,
/* end time */ periodStart + 10,
/* data key */ 1),
/* startTime= */ periodStart,
/* endTime= */ periodStart + 10,
/* dataKey= */ 1),
createSegmentDB(
/* start time */ periodStart + 10,
/* end time */ periodStart + 20,
/* data key */ 2),
/* startTime= */ periodStart + 10,
/* endTime= */ periodStart + 20,
/* dataKey= */ 2),
createSegmentDB(
/* start time */ periodStart + 20,
/* end time */ periodStart + 25,
/* data key */ 3),
/* startTime= */ periodStart + 20,
/* endTime= */ periodStart + 25,
/* dataKey= */ 3),
],
variantIds: variantIds,
};
@@ -341,17 +341,17 @@ describe('ManifestConverter', () => {
keyId: null,
segments: [
createSegmentDB(
/* start time */ periodStart,
/* end time */ periodStart + 10,
/* data key */ 1),
/* startTime= */ periodStart,
/* endTime= */ periodStart + 10,
/* dataKey= */ 1),
createSegmentDB(
/* start time */ periodStart + 10,
/* end time */ periodStart + 20,
/* data key */ 2),
/* startTime= */ periodStart + 10,
/* endTime= */ periodStart + 20,
/* dataKey= */ 2),
createSegmentDB(
/* start time */ periodStart + 20,
/* end time */ periodStart + 25,
/* data key */ 3),
/* startTime= */ periodStart + 20,
/* endTime= */ periodStart + 25,
/* dataKey= */ 3),
],
variantIds: variantIds,
};
@@ -384,17 +384,17 @@ describe('ManifestConverter', () => {
keyId: null,
segments: [
createSegmentDB(
/* start time */ periodStart,
/* end time */ periodStart + 10,
/* data key */ 1),
/* startTime= */ periodStart,
/* endTime= */ periodStart + 10,
/* dataKey= */ 1),
createSegmentDB(
/* start time */ periodStart + 10,
/* end time */ periodStart + 20,
/* data key */ 2),
/* startTime= */ periodStart + 10,
/* endTime= */ periodStart + 20,
/* dataKey= */ 2),
createSegmentDB(
/* start time */ periodStart + 20,
/* end time */ periodStart + 25,
/* data key */ 3),
/* startTime= */ periodStart + 20,
/* endTime= */ periodStart + 25,
/* dataKey= */ 3),
],
variantIds: [5],
};
+15 -15
View File
@@ -458,14 +458,14 @@ filterDescribe('Storage', storageSupport, () => {
return new ArrayBuffer(16);
});
};
setResponseFor(audioSegment1Uri, /* depending on */ null);
setResponseFor(audioSegment2Uri, /* depending on */ videoSegment1Uri);
setResponseFor(audioSegment3Uri, /* depending on */ videoSegment2Uri);
setResponseFor(audioSegment4Uri, /* depending on */ videoSegment3Uri);
setResponseFor(videoSegment1Uri, /* depending on */ audioSegment1Uri);
setResponseFor(videoSegment2Uri, /* depending on */ audioSegment2Uri);
setResponseFor(videoSegment3Uri, /* depending on */ audioSegment3Uri);
setResponseFor(videoSegment4Uri, /* depending on */ audioSegment4Uri);
setResponseFor(audioSegment1Uri, null);
setResponseFor(audioSegment2Uri, videoSegment1Uri);
setResponseFor(audioSegment3Uri, videoSegment2Uri);
setResponseFor(audioSegment4Uri, videoSegment3Uri);
setResponseFor(videoSegment1Uri, audioSegment1Uri);
setResponseFor(videoSegment2Uri, audioSegment2Uri);
setResponseFor(videoSegment3Uri, audioSegment3Uri);
setResponseFor(videoSegment4Uri, audioSegment4Uri);
// Use a real Player as Storage will use it to get a networking
// engine.
@@ -1321,12 +1321,12 @@ filterDescribe('Storage', storageSupport, () => {
startTime,
endTime,
() => [uri],
/* startByte */ 0,
/* endByte */ null,
/* initSegmentReference */ null,
/* timestampOffset */ 0,
/* appendWindowStart */ 0,
/* appendWindowEnd */ Infinity);
/* startByte= */ 0,
/* endByte= */ null,
/* initSegmentReference= */ null,
/* timestampOffset= */ 0,
/* appendWindowStart= */ 0,
/* appendWindowEnd= */ Infinity);
}
/**
@@ -1537,7 +1537,7 @@ filterDescribe('Storage', storageSupport, () => {
try {
drm.configure(player.getConfiguration().drm);
const variants = shaka.util.Periods.getAllVariantsFrom(manifest.periods);
await drm.initForStorage(variants, /* usePersistentLicenses */ true);
await drm.initForStorage(variants, /* usePersistentLicenses= */ true);
await action(drm);
} finally {
await drm.destroy();
+1 -1
View File
@@ -239,7 +239,7 @@ describe('Player', () => {
// On some platforms, currentTime is less than duration, but it should be
// close.
expect(video.currentTime).toBeCloseTo(
video.duration, 1 /* decimal place */);
video.duration, /* decimal= */ 1);
}
}
+21 -21
View File
@@ -43,24 +43,24 @@ describe('Player Src Equals', () => {
// This test verifies that we can successfully load content that requires us
// to use |src=|.
it('loads content', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
});
// This test verifys that we can successfully unload content that required
// |src=| to load.
it('unloads content', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
await player.unload(/* initMediaSource= */ false);
});
it('can get asset uri after loading', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
expect(player.getAssetUri()).toBe(SMALL_MP4_CONTENT_URI);
});
// TODO: test an HLS live stream on platforms supporting native HLS
it('considers simple mp4 content to be VOD"', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
expect(player.isLive()).toBeFalsy();
expect(player.isInProgress()).toBeFalsy();
});
@@ -68,7 +68,7 @@ describe('Player Src Equals', () => {
// TODO: test an audio-only mp4
// TODO: test audio-only HLS on platforms with native HLS
it('considers audio-video mp4 content to be audio-video', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
expect(player.isAudioOnly()).toBeFalsy();
});
@@ -81,7 +81,7 @@ describe('Player Src Equals', () => {
// Since we don't have any manifest data, we must assume that we can seek
// anywhere in the presentation; end-time will come from the media element.
it('allows seeking throughout the presentation', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
// For src=, the seekRange is based on video.seekable, so wait for this
// event before proceeding to check seekRange.
@@ -119,7 +119,7 @@ describe('Player Src Equals', () => {
// TODO: test HLS without DRM on platforms with native HLS
// TODO: test HLS with DRM on platforms with native HLS
it('considers simple content to be clear ', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
expect(player.keySystem()).toBe('');
expect(player.drmInfo()).toBe(null);
@@ -130,7 +130,7 @@ describe('Player Src Equals', () => {
// accurate information. However we can still report what the media element
// surfaces.
it('reports buffering information', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
// For playback to begin so that we have some content buffered.
video.play();
@@ -154,7 +154,7 @@ describe('Player Src Equals', () => {
// When we load content via src=, can we use the trick play controls to
// control the playback rate.
it('can control trick play rate', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
// Let playback run for a little.
video.play();
@@ -174,7 +174,7 @@ describe('Player Src Equals', () => {
// TODO: test audio-video mp4 content on platforms with audioTracks API
it('reports variant tracks for video-only mp4 content', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
// On platforms with audioTracks, such as Safari, we get one track here.
if (video.audioTracks) {
@@ -186,7 +186,7 @@ describe('Player Src Equals', () => {
// TODO: test HLS on platforms with native HLS
it('allows selecting variant tracks', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
// We can only get a variant track here on certain browsers.
const tracks = player.getVariantTracks();
@@ -200,13 +200,13 @@ describe('Player Src Equals', () => {
// TODO: test HLS with text tracks on platforms with native HLS
it('reports no text tracks for simple mp4 content', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
expect(player.getTextTracks()).toEqual([]);
});
// TODO: test HLS on platforms with native HLS
it('allows selecting text tracks', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
// We can only get a text track here on certain browsers.
const tracks = player.getTextTracks();
@@ -220,7 +220,7 @@ describe('Player Src Equals', () => {
// TODO: test HLS on platforms with native HLS
it('returns no languages or roles for simple mp4 content', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
// On platforms with audioTracks, such as Safari, we get one track, with
// language set to whatever is in the mp4.
@@ -243,7 +243,7 @@ describe('Player Src Equals', () => {
// TODO: test language selection w/ HLS on platforms with native HLS
// This test is disabled until then.
xit('cannot select language or role', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
const language = 'en';
const role = 'main';
@@ -268,7 +268,7 @@ describe('Player Src Equals', () => {
// TODO: test text visibility w/ HLS on platforms with native HLS
// This test is disabled until then.
xit('persists the text visibility setting', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
expect(player.isTextTrackVisible()).toBe(false);
@@ -282,7 +282,7 @@ describe('Player Src Equals', () => {
// Even though we loaded content using |src=| we should still be able to get
// the playhead position as normal.
it('can get the playhead position', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
expect(video.readyState).toBeGreaterThan(0);
expect(video.currentTime).toBeCloseTo(0);
@@ -301,7 +301,7 @@ describe('Player Src Equals', () => {
// Even though we are not using all the internals, we should still get some
// meaningful statistics.
it('can get stats', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
// Wait some time for playback to start so that we will have a load latency
// value.
@@ -316,7 +316,7 @@ describe('Player Src Equals', () => {
// Because we have no manifest, we can't add text tracks.
it('cannot add text tracks', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
const pendingAdd = player.addTextTrack(
'test:need-a-uri-for-text',
@@ -330,14 +330,14 @@ describe('Player Src Equals', () => {
// Since we are not in-charge of streaming, calling |retryStreaming| should
// have no effect.
it('requesting streaming retry does nothing', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
expect(player.retryStreaming()).toBeFalsy();
});
// Since we are not loading a manifest, we can't return a manifest.
// |getManifest| should return |null|.
it('has no manifest to return', async () => {
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime */ null);
await loadWithSrcEquals(SMALL_MP4_CONTENT_URI, /* startTime= */ null);
expect(player.getManifest()).toBeFalsy();
});
+1 -1
View File
@@ -3250,7 +3250,7 @@ describe('Player', () => {
};
await player.load(
fakeManifestUri, /* startTime */ 0, returnManifest(manifest));
fakeManifestUri, /* startTime= */ 0, returnManifest(manifest));
// Ensure this is seen as a live stream, or else the test is invalid.
expect(player.isLive()).toBe(true);
+6 -6
View File
@@ -286,8 +286,8 @@ describe('Walker', () => {
// be non-interruptible and the second route interruptible so that we can
// see both types be cancelled by |destroy|. The non-interruptible route
// must before first or else it would interrupt the other route.
const goToC = startNewRoute(nodeC, /* interruptible */ false);
const goToB = startNewRoute(nodeB, /* interruptible */ true);
const goToC = startNewRoute(nodeC, /* interruptible= */ false);
const goToB = startNewRoute(nodeB, /* interruptible= */ true);
/** @type {jasmine.Spy} */
const canceledCSpy = jasmine.createSpy('cancel c');
@@ -325,7 +325,7 @@ describe('Walker', () => {
// Go to D (passing through C). This should throw an error, so wait for the
// error to be seen. The route must be abortable because we are going to
// throw an abortable error.
await failsRoute(startNewRoute(nodeD, /* interruptible */ true));
await failsRoute(startNewRoute(nodeD, /* interruptible= */ true));
expect(handleErrorSpy).toHaveBeenCalled();
});
@@ -347,11 +347,11 @@ describe('Walker', () => {
// Wait for us to enter node d before continuing. We introduce a small delay
// to ensure that we are "stuck" on the abortable operation.
const goingToD = startNewRoute(nodeD, /* interruptible */ true);
const goingToD = startNewRoute(nodeD, /* interruptible= */ true);
await waitUntilEntering(goingToD, nodeC);
await shaka.test.Util.shortDelay();
await completesRoute(startNewRoute(nodeE, /* interruptible */ true));
await completesRoute(startNewRoute(nodeE, /* interruptible= */ true));
expect(handleErrorSpy).toHaveBeenCalled();
});
@@ -369,7 +369,7 @@ describe('Walker', () => {
// Wait for us to enter node d before continuing. We introduce a small delay
// to ensure that we are "stuck" on the abortable operation.
const goingToD = startNewRoute(nodeD, /* interruptible */ true);
const goingToD = startNewRoute(nodeD, /* interruptible= */ true);
await waitUntilEntering(goingToD, nodeC);
await shaka.test.Util.shortDelay();
+1 -1
View File
@@ -247,7 +247,7 @@ function getClientArg(name) {
// TODO: file a bug on Tizen
if (shaka.util.Platform.isTizen()) {
afterEach((done) => { // eslint-disable-line no-restricted-syntax
originalSetTimeout(done, 100 /* ms */);
originalSetTimeout(done, /* ms= */ 100);
});
}
+2 -2
View File
@@ -263,7 +263,7 @@ shaka.test.Dash = class {
' <S d="10" r="-1" />',
'</SegmentTimeline>',
];
const source = makeManifestText(timeline, '', 50 /* duration */);
const source = makeManifestText(timeline, '', /* duration= */ 50);
const references = [
ManifestParser.makeReference('s1.mp4', 1, 5, 10, baseUri),
ManifestParser.makeReference('s2.mp4', 2, 10, 20, baseUri),
@@ -281,7 +281,7 @@ shaka.test.Dash = class {
'</SegmentTimeline>',
];
const source =
makeManifestText(timeline, '', 50 /* duration */, 30 /* start */);
makeManifestText(timeline, '', /* duration= */ 50, /* start= */ 30);
const references = [
ManifestParser.makeReference('s1.mp4', 1, 30, 40, baseUri),
ManifestParser.makeReference('s2.mp4', 2, 40, 50, baseUri),
+8 -8
View File
@@ -630,15 +630,15 @@ shaka.test.ManifestGenerator.Stream = class {
const end = Math.min(totalDuration, (index + 1) * segmentDuration);
return new this.manifest_.shaka_.media.SegmentReference(
index,
/* startTime */ periodStart + start,
/* endTime */ periodStart + end,
/* startTime= */ periodStart + start,
/* endTime= */ periodStart + end,
getUris,
/* startByte */ 0,
/* endByte */ segmentSize,
/* startByte= */ 0,
/* endByte= */ segmentSize,
this.initSegmentReference_,
/* timestampOffset */ periodStart,
/* appendWindowStart */ periodStart,
/* appendWindowEnd */ Infinity);
/* timestampOffset= */ periodStart,
/* appendWindowStart= */ periodStart,
/* appendWindowEnd= */ Infinity);
};
}
@@ -656,7 +656,7 @@ shaka.test.ManifestGenerator.Stream = class {
};
this.segmentIndex =
this.manifest_.shaka_.media.SegmentIndex.forSingleSegment(
/* startTime */ 0, duration, [uri]);
/* startTime= */ 0, duration, [uri]);
}
/**
+2 -2
View File
@@ -366,7 +366,7 @@ shaka.test.StreamGenerator = class {
const size = reader.readUint32();
const type = reader.readUint32();
goog.asserts.assert(
type == 0x6d646864 /* mdhd */,
type == 0x6d646864, // mdhd
'initSegment does not contain an mdhd box at the specified offset.');
const largesizePresent = size == 1;
@@ -420,7 +420,7 @@ shaka.test.StreamGenerator = class {
const size = reader.readUint32();
const type = reader.readUint32();
goog.asserts.assert(
type == 0x74666474 /* tfdt */,
type == 0x74666474, // tfdt
'segment does not contain a tfdt box at the specified offset.');
const largesizePresent = size == 1;
+4 -4
View File
@@ -242,11 +242,11 @@ shaka.test.StreamingEngineUtil = class {
return new shaka.media.SegmentReference(
position,
/* startTime */ timestampOffset + (position - 1) * d,
/* endTime */ timestampOffset + position * d,
/* startTime= */ timestampOffset + (position - 1) * d,
/* endTime= */ timestampOffset + position * d,
getUris,
/* startByte */ 0,
/* endByte */ null,
/* startByte= */ 0,
/* endByte= */ null,
initSegmentReference,
timestampOffset,
appendWindowStart,
+2 -2
View File
@@ -114,8 +114,8 @@ shaka.test.UiUtils = class {
// (in test/test/boot.js). This tells it that we've added a new
// stylesheet, so LESS can process it.
less.registerStylesheetsImmediately();
await less.refresh(/* reload */ true,
/* modifyVars*/ false, /* clearFileCache */ false);
await less.refresh(/* reload= */ true,
/* modifyVars= */ false, /* clearFileCache= */ false);
}
/**
+2 -2
View File
@@ -246,7 +246,7 @@ shaka.test.Util = class {
static fetch(uri) {
return new Promise(((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open('GET', uri, true /* asynchronous */);
xhr.open('GET', uri, /* asynchronous= */ true);
xhr.responseType = 'arraybuffer';
xhr.onload = (event) => {
@@ -263,7 +263,7 @@ shaka.test.Util = class {
reject('shaka.test.Util.fetch failed: ' + uri);
};
xhr.send(null /* body */);
xhr.send(/* body= */ null);
}));
}
+6 -6
View File
@@ -134,7 +134,7 @@ describe('TextEngine', () => {
textEngine.setSelectedClosedCaptionId('CC1', 0);
textEngine.storeAndAppendClosedCaptions(
[caption], /* startTime */ 0, /* endTime */ 2, /* offset */ 0);
[caption], /* startTime= */ 0, /* endTime= */ 2, /* offset= */ 0);
expect(mockDisplayer.appendSpy).toHaveBeenCalled();
});
@@ -150,7 +150,7 @@ describe('TextEngine', () => {
textEngine.setSelectedClosedCaptionId('CC3', 0);
textEngine.storeAndAppendClosedCaptions(
[caption], /* startTime */ 0, /* endTime */ 2, /* offset */ 0);
[caption], /* startTime= */ 0, /* endTime= */ 2, /* offset= */ 0);
expect(mockDisplayer.appendSpy).not.toHaveBeenCalled();
});
@@ -184,12 +184,12 @@ describe('TextEngine', () => {
// Text Engine stores all the closed captions as a two layer map.
// {closed caption id -> {start and end time -> cues}}
textEngine.storeAndAppendClosedCaptions(
[caption0], /* startTime */ 0, /* endTime */ 1, /* offset */ 0);
[caption0], /* startTime= */ 0, /* endTime= */ 1, /* offset= */ 0);
expect(textEngine.getNumberOfClosedCaptionChannels()).toBe(1);
expect(textEngine.getNumberOfClosedCaptionsInChannel('CC1')).toBe(1);
textEngine.storeAndAppendClosedCaptions(
[caption1], /* startTime */ 1, /* endTime */ 2, /* offset */ 0);
[caption1], /* startTime= */ 1, /* endTime= */ 2, /* offset= */ 0);
// Caption1 has the same stream id with caption0, but different start and
// end time. The closed captions map should have 1 key CC1, and two values
// for two start and end times.
@@ -197,7 +197,7 @@ describe('TextEngine', () => {
expect(textEngine.getNumberOfClosedCaptionsInChannel('CC1')).toBe(2);
textEngine.storeAndAppendClosedCaptions(
[caption2], /* startTime */ 1, /* endTime */ 2, /* offset */ 0);
[caption2], /* startTime= */ 1, /* endTime= */ 2, /* offset= */ 0);
// Caption2 has a different stream id CC3, so the closed captions map
// should have two different keys, CC1 and CC3.
expect(textEngine.getNumberOfClosedCaptionChannels()).toBe(2);
@@ -215,7 +215,7 @@ describe('TextEngine', () => {
textEngine.setSelectedClosedCaptionId('CC1', 0);
textEngine.storeAndAppendClosedCaptions(
[caption], /* startTime */ 0, /* endTime */ 2, /* offset */ 1000);
[caption], /* startTime= */ 0, /* endTime= */ 2, /* offset= */ 1000);
expect(mockDisplayer.appendSpy).toHaveBeenCalledWith([
jasmine.objectContaining({
startTime: 1000,
+2 -2
View File
@@ -187,7 +187,7 @@ describe('Localization', () => {
it('fires when we change to a locale we have not loaded', () => {
const events = [];
const localization = new Localization(/* fallback */ HALFLING_COMMON);
const localization = new Localization(/* fallback= */ HALFLING_COMMON);
collectEvents(localization, Localization.UNKNOWN_LOCALES, events);
localization.insert(HALFLING_COMMON, new Map());
@@ -201,7 +201,7 @@ describe('Localization', () => {
it('will not fire after we add the locale', () => {
const events = [];
const localization = new Localization(/* fallback */ HALFLING_COMMON);
const localization = new Localization(/* fallback= */ HALFLING_COMMON);
collectEvents(localization, Localization.UNKNOWN_LOCALES, events);
// We should see an event telling us that both elvish and dwarfish are
+2 -2
View File
@@ -299,8 +299,8 @@ describe('UI', () => {
languagesToButtons = mapChoicesToButtons(
/* allButtons= */ languageButtons,
/* choices */ langsFromContent,
/* modifier */ getNativeName
/* choices= */ langsFromContent,
/* modifier= */ getNativeName
);
const button = languagesToButtons.get(newLanguage);
+6 -4
View File
@@ -59,7 +59,8 @@ describe('UI', () => {
/** @type {!HTMLElement} */ (document.createElement('div'));
document.body.appendChild(container);
await UiUtils.createUIThroughDOMAutoSetup([container], /* videos */ []);
await UiUtils.createUIThroughDOMAutoSetup(
[container], /* videos= */ []);
});
it('has all the basic elements', () => {
@@ -84,7 +85,7 @@ describe('UI', () => {
document.body.appendChild(container2);
await UiUtils.createUIThroughDOMAutoSetup([container1, container2],
/* videos */ []);
/* videos= */ []);
});
it('has all the basic elements', () => {
@@ -101,7 +102,8 @@ describe('UI', () => {
video = shaka.test.UiUtils.createVideoElement();
document.body.appendChild(video);
await UiUtils.createUIThroughDOMAutoSetup(/* containers */ [], [video]);
await UiUtils.createUIThroughDOMAutoSetup(
/* containers= */ [], [video]);
});
it('has all the basic elements', () => {
@@ -127,7 +129,7 @@ describe('UI', () => {
videos.push(video);
}
await UiUtils.createUIThroughDOMAutoSetup(/* containers */ [], videos);
await UiUtils.createUIThroughDOMAutoSetup(/* containers= */ [], videos);
});
it('has all the basic elements', () => {
+2 -2
View File
@@ -353,7 +353,7 @@ describe('Mp4Parser', () => {
new shaka.util.Mp4Parser()
.box('b003', Util.spyFunc(parentBox))
.box('b032', Util.spyFunc(childBox1))
.parse(partialBoxWithSampleDescription, false /* partialOkay */);
.parse(partialBoxWithSampleDescription, /* partialOkay= */ false);
}).toThrow(expected);
parentBox.calls.reset();
@@ -363,7 +363,7 @@ describe('Mp4Parser', () => {
new shaka.util.Mp4Parser()
.box('b003', Util.spyFunc(parentBox))
.box('b032', Util.spyFunc(childBox1))
.parse(partialBoxWithSampleDescription, true /* partialOkay */);
.parse(partialBoxWithSampleDescription, /* partialOkay= */ true);
expect(parentBox).toHaveBeenCalledTimes(1);
expect(childBox1).toHaveBeenCalledTimes(1);
+2 -2
View File
@@ -91,7 +91,7 @@ describe('StringUtils', () => {
it('converts toUTF16-LE', () => {
const str = 'Xe\u4524\u1952';
const arr = [0x58, 0, 0x65, 0, 0x24, 0x45, 0x52, 0x19];
const buffer = StringUtils.toUTF16(str, /* littleEndian */ true);
const buffer = StringUtils.toUTF16(str, /* littleEndian= */ true);
expect(shaka.util.BufferUtils.toUint8(buffer))
.toEqual(new Uint8Array(arr));
});
@@ -99,7 +99,7 @@ describe('StringUtils', () => {
it('converts toUTF16-BE', () => {
const str = 'Xe\u4524\u1952';
const arr = [0, 0x58, 0, 0x65, 0x45, 0x24, 0x19, 0x52];
const buffer = StringUtils.toUTF16(str, /* littleEndian */ false);
const buffer = StringUtils.toUTF16(str, /* littleEndian= */ false);
expect(shaka.util.BufferUtils.toUint8(buffer))
.toEqual(new Uint8Array(arr));
});
+2 -2
View File
@@ -93,9 +93,9 @@ shaka.ui.AdCounter = class extends shaka.ui.Element {
if (secondsLeft > 0) {
const timePassed = this.ad.getDuration() - secondsLeft;
const timePassedStr =
shaka.ui.Utils.buildTimeString(timePassed, /* showHour */ false);
shaka.ui.Utils.buildTimeString(timePassed, /* showHour= */ false);
const adLength = shaka.ui.Utils.buildTimeString(
this.ad.getDuration(), /* showHour */ false);
this.ad.getDuration(), /* showHour= */ false);
const timeString = timePassedStr + ' / ' + adLength;
const adsInAdPod = this.ad.getSequenceLength();
+1 -1
View File
@@ -61,7 +61,7 @@ shaka.ui.AudioLanguageSelection = class extends shaka.ui.SettingsMenu {
shaka.ui.LanguageUtils.updateTracks(tracks, this.menu,
(track) => this.onAudioTrackSelected_(track),
/* updateChosen */ true, this.currentSelection, this.localization,
/* updateChosen= */ true, this.currentSelection, this.localization,
this.controls.getConfig().trackLabelFormat);
shaka.ui.Utils.focusOnTheChosenItem(this.menu);
+2 -2
View File
@@ -98,7 +98,7 @@ shaka.ui.Overlay = class {
const ret = this.defaultConfig_();
shaka.util.ConfigUtils.mergeConfigObjects(
ret, this.config_, this.defaultConfig_(),
/* overrides (only used for player config)*/ {}, /* path */ '');
/* overrides= */ {}, /* path= */ '');
return ret;
}
@@ -124,7 +124,7 @@ shaka.ui.Overlay = class {
shaka.util.ConfigUtils.mergeConfigObjects(
this.config_, config, this.defaultConfig_(),
/* overrides (only used for player config)*/ {}, /* path */ '');
/* overrides= */ {}, /* path= */ '');
// If a cast receiver app id has been given, add a cast button to the UI
if (this.config_.castReceiverAppId &&