Reconcile eviction comment wording; add handleSourceEnded cascade test (Phase 21.1)
The inclusive <= bound is correct; comments now say 'at or behind'. New test drives eviction through the real onended trigger with a live mid-array source pinning the frontier.
This commit is contained in:
@@ -136,7 +136,7 @@ export class PlaybackScheduler {
|
||||
* Drop already-played buffers from the front of the array, reclaiming their decoded float
|
||||
* memory, and advance the time anchor so all position/index bookkeeping stays exact.
|
||||
*
|
||||
* Eviction frontier: any buffer whose absolute END time is older than
|
||||
* Eviction frontier: any buffer whose absolute END time is at or older than
|
||||
* (currentPosition - backRetainSeconds) is droppable. We evict a contiguous run from the
|
||||
* front only — buffers are appended in playback order, so the front is always the oldest.
|
||||
*
|
||||
@@ -179,7 +179,7 @@ export class PlaybackScheduler {
|
||||
let accumulatedEnd = this.playbackOffset;
|
||||
for (let i = 0; i < maxEvictable; i++) {
|
||||
accumulatedEnd += this.buffers[i].duration;
|
||||
// Drop only buffers whose END is strictly behind the retain frontier.
|
||||
// Drop buffers whose END is at or behind the retain frontier (inclusive bound).
|
||||
if (accumulatedEnd <= evictBefore) {
|
||||
evictCount = i + 1;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user