diff --git a/src/controller/audio-stream-controller.ts b/src/controller/audio-stream-controller.ts index de2d338a523..c890007b4cb 100644 --- a/src/controller/audio-stream-controller.ts +++ b/src/controller/audio-stream-controller.ts @@ -251,9 +251,9 @@ class AudioStreamController private doTickIdle() { const { hls, levels, media, trackId } = this; - const config = hls.config; - if (!levels) { + + if (!levels || !levels[trackId]) { return; } @@ -270,9 +270,6 @@ class AudioStreamController return; } - if (!levels || !levels[trackId]) { - return; - } const levelInfo = levels[trackId]; const trackDetails = levelInfo.details; diff --git a/src/controller/base-stream-controller.ts b/src/controller/base-stream-controller.ts index 43bca8124ca..db337f8ad62 100644 --- a/src/controller/base-stream-controller.ts +++ b/src/controller/base-stream-controller.ts @@ -41,6 +41,9 @@ import type { HlsEventEmitter } from '../events'; import type { NetworkComponentAPI } from '../types/component-api'; import type { SourceBufferName } from '../types/buffer'; +type ResolveFragLoaded = (FragLoadedEndData) => void; +type RejectFragLoaded = (LoadError) => void; + export const State = { STOPPED: 'STOPPED', IDLE: 'IDLE', @@ -478,9 +481,8 @@ export default class BaseStreamController // If we did not load parts, or loaded all parts, we have complete (not partial) fragment data const complete = !partsLoaded || - (partsLoaded && - (partsLoaded.length === 0 || - partsLoaded.some((fragLoaded) => !fragLoaded))); + partsLoaded.length === 0 || + partsLoaded.some((fragLoaded) => !fragLoaded); const chunkMeta = new ChunkMetadata( frag.level, frag.sn as number, @@ -570,7 +572,7 @@ export default class BaseStreamController progressCallback: FragmentLoadProgressCallback ): Promise { return new Promise( - (resolve: (FragLoadedEndData) => void, reject: (LoadError) => void) => { + (resolve: ResolveFragLoaded, reject: RejectFragLoaded) => { const partsLoaded: FragLoadedData[] = []; const loadPartIndex = (index: number) => { const part = partList[index]; diff --git a/src/controller/cap-level-controller.ts b/src/controller/cap-level-controller.ts index b0f55a01af0..9c616ba051f 100644 --- a/src/controller/cap-level-controller.ts +++ b/src/controller/cap-level-controller.ts @@ -244,7 +244,7 @@ class CapLevelController implements ComponentAPI { width: number, height: number ): number { - if (!levels || (levels && !levels.length)) { + if (!levels || !levels.length) { return -1; } diff --git a/src/controller/level-helper.ts b/src/controller/level-helper.ts index 7621073dd68..08ff0829e9d 100644 --- a/src/controller/level-helper.ts +++ b/src/controller/level-helper.ts @@ -369,7 +369,7 @@ export function computeReloadInterval( timeSinceLastModified > 0 && timeSinceLastModified < reloadInterval * 3; const roundTrip = stats.loading.end - stats.loading.start; - let estimatedTimeUntilUpdate = reloadInterval; + let estimatedTimeUntilUpdate; let availabilityDelay = newDetails.availabilityDelay; // let estimate = 'average'; diff --git a/src/controller/timeline-controller.ts b/src/controller/timeline-controller.ts index ea49a5d4fb2..994f9864010 100644 --- a/src/controller/timeline-controller.ts +++ b/src/controller/timeline-controller.ts @@ -428,10 +428,8 @@ export class TimelineController implements ComponentAPI { if (data.frag.type === PlaylistLevelType.MAIN) { const sn = data.frag.sn; if (sn !== lastSn + 1) { - if (cea608Parser1 && cea608Parser2) { - cea608Parser1.reset(); - cea608Parser2.reset(); - } + cea608Parser1.reset(); + cea608Parser2.reset(); } this.lastSn = sn as number; } diff --git a/src/crypt/aes-decryptor.ts b/src/crypt/aes-decryptor.ts index 0293b59f5e5..161570e2629 100644 --- a/src/crypt/aes-decryptor.ts +++ b/src/crypt/aes-decryptor.ts @@ -326,7 +326,6 @@ export default class AESDecryptor { (invSBOX[(s1 >> 8) & 0xff] << 8) ^ invSBOX[s2 & 0xff] ^ invKeySchedule[ksRow + 3]; - ksRow = ksRow + 3; // Write outputInt32[offset] = swapWord(t0 ^ initVector0); diff --git a/src/remux/mp4-remuxer.ts b/src/remux/mp4-remuxer.ts index 9c7b09f31a9..e556195d039 100644 --- a/src/remux/mp4-remuxer.ts +++ b/src/remux/mp4-remuxer.ts @@ -457,7 +457,6 @@ export default class MP4Remuxer implements Remuxer { } } firstDTS = inputSamples[0].dts; - lastDTS = inputSamples[nbSamples - 1].dts; } // if fragment are contiguous, detect hole/overlapping between fragments diff --git a/src/types/remuxer.ts b/src/types/remuxer.ts index 320108bdbab..10bb2823a03 100644 --- a/src/types/remuxer.ts +++ b/src/types/remuxer.ts @@ -2,7 +2,6 @@ import type { TrackSet } from './track'; import { DemuxedAudioTrack, DemuxedMetadataTrack, - DemuxedTrack, DemuxedUserdataTrack, DemuxedVideoTrack, MetadataSample, diff --git a/src/utils/cea-608-parser.ts b/src/utils/cea-608-parser.ts index d242cff215f..6e8f02fb7c5 100644 --- a/src/utils/cea-608-parser.ts +++ b/src/utils/cea-608-parser.ts @@ -1299,7 +1299,7 @@ class Cea608Parser { * @returns {Object} pacData with style parameters. */ interpretPAC(row: number, byte: number): PACData { - let pacIndex = byte; + let pacIndex; const pacData: PACData = { color: null, italics: false, @@ -1353,7 +1353,7 @@ class Cea608Parser { } if (charCode1 >= 0x11 && charCode1 <= 0x13) { // Special character - let oneCode = b; + let oneCode; if (charCode1 === 0x11) { oneCode = b + 0x50; } else if (charCode1 === 0x12) { diff --git a/src/utils/mp4-tools.ts b/src/utils/mp4-tools.ts index 785611ebfe2..37119db36fd 100644 --- a/src/utils/mp4-tools.ts +++ b/src/utils/mp4-tools.ts @@ -123,7 +123,7 @@ type SidxInfo = { export function parseSegmentIndex(initSegment: Uint8Array): SidxInfo | null { const moovBox = findBox(initSegment, ['moov']); - const moov = moovBox ? moovBox[0] : null; + const moov = moovBox[0]; const moovEndOffset = moov ? moov.end : null; // we need this in case we need to chop of garbage of the end of current data const sidxBox = findBox(initSegment, ['sidx']); diff --git a/tools/mp4-inspect.js b/tools/mp4-inspect.js index 60b2158e018..cf803c9b93a 100644 --- a/tools/mp4-inspect.js +++ b/tools/mp4-inspect.js @@ -182,11 +182,10 @@ var // this is the start of a huge multi-line var decl flags: new Uint8Array(data.subarray(1, 4)), handlerType: parseType(data.subarray(8, 12)), name: '', - }, - i = 8; + }; // parse out the name field - for (i = 24; i < data.byteLength; i++) { + for (var i = 24; i < data.byteLength; i++) { if (data[i] === 0x00) { // the name field is null-terminated i++;