From 6287c96cefcf625b5d0b6c748db8d240ceb69f7b Mon Sep 17 00:00:00 2001 From: Paul Berberian Date: Thu, 5 Sep 2024 11:08:12 +0200 Subject: [PATCH] Add important logs related to freezing --- src/core/main/common/FreezeResolver.ts | 14 ++++++++++++++ src/core/main/worker/worker_main.ts | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/src/core/main/common/FreezeResolver.ts b/src/core/main/common/FreezeResolver.ts index d400b110c6..a430cedb4b 100644 --- a/src/core/main/common/FreezeResolver.ts +++ b/src/core/main/common/FreezeResolver.ts @@ -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() && @@ -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; @@ -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 = @@ -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) { diff --git a/src/core/main/worker/worker_main.ts b/src/core/main/worker/worker_main.ts index cff072fc55..b8fe22e9fb 100644 --- a/src/core/main/worker/worker_main.ts +++ b/src/core/main/worker/worker_main.ts @@ -146,6 +146,7 @@ export default function initializeWorkerMain() { currentLoadedContentTaskCanceller.signal.register(() => { currentContentObservationRef.finish(); }); + log.debug("WP: Loading new pepared content."); loadOrReloadPreparedContent( msg.value, contentPreparer, @@ -478,6 +479,7 @@ function loadOrReloadPreparedContent( playbackObservationRef: IReadOnlySharedReference, parentCancelSignal: CancellationSignal, ) { + log.debug("WP: Loading prepared content"); const currentLoadCanceller = new TaskCanceller(); currentLoadCanceller.linkToSignal(parentCancelSignal); @@ -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,