Skip to content

Commit

Permalink
Add important logs related to freezing
Browse files Browse the repository at this point in the history
  • Loading branch information
peaBerberian committed Sep 5, 2024
1 parent a8a80a2 commit 6287c96
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/core/main/common/FreezeResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ export default class FreezeResolver {
} else if (rebuffering !== null) {
freezingTs = rebuffering.timestamp;
}

log.info(
"FR: Freeze detected",
freezingTs,
now - (freezingTs ?? now),
observation.position.isAwaitingFuturePosition(),
);

if (
freezingTs !== null &&
!observation.position.isAwaitingFuturePosition() &&
Expand All @@ -315,6 +323,7 @@ export default class FreezeResolver {
timestamp: now,
position: freezingPosition + UNFREEZING_DELTA_POSITION,
};
log.debug("FR: trying to flush to un-freeze");

this._decipherabilityFreezeStartingTimestamp = null;
this._ignoreFreezeUntil = now + 6000;
Expand All @@ -330,6 +339,7 @@ export default class FreezeResolver {
}

if (this._decipherabilityFreezeStartingTimestamp === null) {
log.debug("FR: Start of a potential decipherability freeze detected");
this._decipherabilityFreezeStartingTimestamp = now;
}
const rebufferingForTooLong =
Expand All @@ -340,6 +350,10 @@ export default class FreezeResolver {
(rebufferingForTooLong || frozenForTooLong) &&
getMonotonicTimeStamp() - this._decipherabilityFreezeStartingTimestamp > 4000
) {
log.debug(
"FR: Investigating long potential decipherability freeze",
this._decipherabilityFreezeStartingTimestamp,
);
let hasOnlyDecipherableSegments = true;
let isClear = true;
for (const ttype of ["audio", "video"] as const) {
Expand Down
9 changes: 9 additions & 0 deletions src/core/main/worker/worker_main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export default function initializeWorkerMain() {
currentLoadedContentTaskCanceller.signal.register(() => {
currentContentObservationRef.finish();
});
log.debug("WP: Loading new pepared content.");
loadOrReloadPreparedContent(
msg.value,
contentPreparer,
Expand Down Expand Up @@ -478,6 +479,7 @@ function loadOrReloadPreparedContent(
playbackObservationRef: IReadOnlySharedReference<IWorkerPlaybackObservation>,
parentCancelSignal: CancellationSignal,
) {
log.debug("WP: Loading prepared content");
const currentLoadCanceller = new TaskCanceller();
currentLoadCanceller.linkToSignal(parentCancelSignal);

Expand Down Expand Up @@ -908,8 +910,15 @@ function loadOrReloadPreparedContent(
if (currentLoadCanceller !== null) {
currentLoadCanceller.cancel();
}
log.debug(
"WP: Reloading MediaSource",
payload.timeOffset,
payload.minimumPosition,
payload.maximumPosition,
);
contentPreparer.reloadMediaSource(payload).then(
() => {
log.info("WP: MediaSource Reloaded, loading...");
loadOrReloadPreparedContent(
{
initialTime: newInitialTime,
Expand Down

0 comments on commit 6287c96

Please sign in to comment.