Skip to content

Commit

Permalink
Skip segment and part directives when last LL-HLS response is older t…
Browse files Browse the repository at this point in the history
…han three target durations

Fix Media Playlist 'advanced' state when no Multivariant Playlist is provided
Related to #6076
  • Loading branch information
robwalch committed Jan 5, 2024
1 parent 4cd3e5a commit 83dceb4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/controller/base-playlist-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,19 @@ export default class BasePlaylistController implements NetworkComponentAPI {
details.targetduration * 1.5,
);
if (currentGoal > 0) {
if (previousDetails && currentGoal > previousDetails.tuneInGoal) {
if (cdnAge > details.targetduration * 3) {
// Omit segment and part directives when the last response was more than 3 target durations ago,
this.log(
`Playlist last advanced ${lastAdvanced.toFixed(
2,
)}s ago. Omitting segment and part directives.`,
);
msn = undefined;
part = undefined;
} else if (
previousDetails?.tuneInGoal &&
cdnAge - details.partTarget > previousDetails.tuneInGoal
) {
// If we attempted to get the next or latest playlist update, but currentGoal increased,
// then we either can't catchup, or the "age" header cannot be trusted.
this.warn(
Expand Down
8 changes: 7 additions & 1 deletion src/controller/level-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,13 @@ export default class LevelController extends BasePlaylistController {
if (curLevel.fragmentError === 0) {
curLevel.loadError = 0;
}
this.playlistLoaded(level, data, curLevel.details);
// Ignore matching details populated by loading a Media Playlist directly
let previousDetails = curLevel.details;
if (previousDetails === data.details && previousDetails.advanced) {
previousDetails = undefined;
}

this.playlistLoaded(level, data, previousDetails);
} else if (data.deliveryDirectives?.skip) {
// received a delta playlist update that cannot be merged
details.deltaUpdateFailed = true;
Expand Down

0 comments on commit 83dceb4

Please sign in to comment.