Skip to content

Commit

Permalink
Add support for Rendition Report switching when their relative urls c…
Browse files Browse the repository at this point in the history
…ontain dot segments (#5124)

Fixes #3572
  • Loading branch information
robwalch authored Dec 21, 2022
1 parent 7e419d5 commit de0daa0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/controller/base-playlist-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,25 @@ export default class BasePlaylistController implements NetworkComponentAPI {

protected switchParams(
playlistUri: string,
previous?: LevelDetails
previous: LevelDetails | undefined
): HlsUrlParameters | undefined {
const renditionReports = previous?.renditionReports;
if (renditionReports) {
for (let i = 0; i < renditionReports.length; i++) {
const attr = renditionReports[i];
const uri = '' + attr.URI;
let uri: string;
try {
uri = new self.URL(attr.URI, previous.url).href;
} catch (error) {
logger.warn(
`Could not construct new URL for Rendition Report: ${error}`
);
uri = attr.URI || '';
}
if (uri === playlistUri.slice(-uri.length)) {
const msn = parseInt(attr['LAST-MSN']) || previous?.lastPartSn;
let part = parseInt(attr['LAST-PART']) || previous?.lastPartIndex;
if (previous && this.hls.config.lowLatencyMode) {
if (this.hls.config.lowLatencyMode) {
const currentGoal = Math.min(
previous.age - previous.partTarget,
previous.targetduration
Expand Down
2 changes: 1 addition & 1 deletion src/types/level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class HlsUrlParameters {
if (this.skip) {
url.searchParams.set('_HLS_skip', this.skip);
}
return url.toString();
return url.href;
}
}

Expand Down

0 comments on commit de0daa0

Please sign in to comment.