Skip to content

Commit

Permalink
Simpler renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
iamboorrito committed May 4, 2024
1 parent cf11379 commit e215504
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions api-extractor/report/hls.js.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ export class BaseStreamController extends TaskLoop implements NetworkComponentAP
// (undocumented)
protected buffering: boolean;
// (undocumented)
protected cachePreloadHint(details: LevelDetails): void;
// (undocumented)
protected checkLiveUpdate(details: LevelDetails): void;
// (undocumented)
protected clearTrackerIfNeeded(frag: Fragment): void;
Expand Down Expand Up @@ -407,8 +409,6 @@ export class BaseStreamController extends TaskLoop implements NetworkComponentAP
// (undocumented)
protected levels: Array<Level> | null;
// (undocumented)
protected loadAndCachePreloadHint(details: LevelDetails): void;
// (undocumented)
protected loadedEndOfParts(partList: Part[], targetBufferTime: number): boolean;
// (undocumented)
protected loadedmetadata: boolean;
Expand Down
9 changes: 4 additions & 5 deletions src/controller/base-stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,12 @@ export default class BaseStreamController
this.initPTS = [];
}

protected loadAndCachePreloadHint(details: LevelDetails): void {
protected cachePreloadHint(details: LevelDetails): void {
const data = details.preloadData;
if (!data) {
return;
}
this.fragmentPreloader.preload(data.frag, data.part);
this.fragmentPreloader.cache(data.frag, data.part);
}

protected onHandlerDestroying() {
Expand Down Expand Up @@ -819,10 +819,9 @@ export default class BaseStreamController
loadedEndOfParts &&
this.hls.lowLatencyMode &&
details?.live &&
details.canBlockReload &&
!this.fragmentPreloader.loading
details.canBlockReload
) {
this.loadAndCachePreloadHint(details);
this.cachePreloadHint(details);
}
// Fragment hint has no parts
return Promise.resolve(null);
Expand Down
2 changes: 1 addition & 1 deletion src/controller/stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ export default class StreamController
) {
this.fragmentPreloader.abort();
} else {
// reset the preloader state to IDLE if we have finished loading, never loaded, or have old data
// reset the preloader state if we have finished loading, never loaded, or have old data
this.fragmentPreloader.revalidate(data);
}
if (newDetails.deltaUpdateFailed) {
Expand Down
8 changes: 4 additions & 4 deletions src/loader/fragment-preloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class FragmentPreloader extends FragmentLoader {
this.log = logger.log.bind(logger, `${logPrefix}>preloader:`);
}

private getPreloadStateStr() {
private getStateString() {
switch (this.storage.state) {
case FragRequestState.IDLE:
return 'IDLE ';
Expand All @@ -61,15 +61,15 @@ export default class FragmentPreloader extends FragmentLoader {
return request !== undefined && state !== FragRequestState.IDLE;
}

public preload(frag: Fragment, part: Part | undefined): void {
public cache(frag: Fragment, part: Part | undefined): void {
if (this.has(frag, part)) {
return;
} else {
this.abort();
}

this.log(
`[${this.getPreloadStateStr()}] create request for [${frag.type}] ${
`[${this.getStateString()}] create request for [${frag.type}] ${
frag.sn
}:${part?.index}`,
);
Expand Down Expand Up @@ -104,7 +104,7 @@ export default class FragmentPreloader extends FragmentLoader {
const cacheHit = this.has(frag, part);

this.log(
`[${this.getPreloadStateStr()}] check cache for [${frag.type}] ${
`[${this.getStateString()}] check cache for [${frag.type}] ${
frag.sn
}:${part?.index ?? ''} / have: ${request.frag.sn}:${request.part?.index ?? ''} hit=${cacheHit}`,
);
Expand Down

0 comments on commit e215504

Please sign in to comment.