cat / goq
clone

turns a linux box into a private steam streaming appliance: plug in, tap your key, play from another computer

fix(portal): report JPEG presenter queue exactly

Dami committed 76ec14f
Expose the compatibility path's actual one-slot pending-image queue to diagnostics and adaptive feedback while retaining the WebCodecs two-slot contract. Cover pending, overwrite, load, error, reset, and feedback projection transitions.
commit
76ec14f51f05fd48e3e01c656915c1a18f1dcd8e
parent
a57de273beda3658070338713a18994ba7d97ccb
author
Dami <dami.etoile@gmail.com>
3 files changed, +51 -3
Mportal/stream-runtime.test.mjs27+++++++++++++++++++++++++++
Mportal/video-pipeline.mjs9+++++++--
Mportal/video-pipeline.test.mjs18+++++++++++++++++-
M portal/stream-runtime.test.mjs +27 -0
M portal/video-pipeline.mjs +7 -2
M portal/video-pipeline.test.mjs +17 -1
@@ -136,6 +136,8 @@ test('configured H.264 keyframes commit format only after decode enqueue', () =>
136136 assert.equal(stats.droppedFrames, 0);137137 assert.equal(stats.recovering, false);138138 assert.equal(stats.decoderQueueCapacity, MAX_DECODE_QUEUE_SIZE);139+ assert.equal(stats.presenterQueueDepth, 0);140+ assert.equal(stats.presenterQueueCapacity, 2);139141 });140142 141143 test('unsupported codecs are dropped before decoder construction', () => {
@@ -222,12 +224,16 @@ test('JPEG fallback keeps its asynchronous base64 draw behavior', () => {
222224 assert.equal(subject.images[0].src, 'blob:test-frame-1');223225 assert.deepEqual(subject.draws, []);224226 assert.deepEqual(subject.revokedUrls, []);227+ assert.equal(subject.pipeline.snapshot().presenterQueueDepth, 1);228+ assert.equal(subject.pipeline.snapshot().presenterQueueCapacity, 1);225229 226230 subject.advance();227231 subject.images[0].onload();228232 assert.equal(subject.draws.length, 1);229233 assert.deepEqual(subject.revokedUrls, ['blob:test-frame-1']);230234 assert.equal(subject.pipeline.snapshot().presentedFrames, 1);235+ assert.equal(subject.pipeline.snapshot().presenterQueueDepth, 0);236+ assert.equal(subject.pipeline.snapshot().presenterQueueCapacity, 1);231237 });232238 233239 test('JPEG fallback presents only the newest frame when loads complete out of order', () => {
@@ -246,7 +252,10 @@ test('JPEG fallback presents only the newest frame when loads complete out of or
246252 subject.pipeline.processFramePayload(payload);247253 const newestLoad = subject.images[1].onload;248254 assert.deepEqual(subject.revokedUrls, ['blob:test-frame-1']);249- assert.equal(subject.pipeline.snapshot().presentationDroppedFrames, 1);255+ const afterOverwrite = subject.pipeline.snapshot();256+ assert.equal(afterOverwrite.presentationDroppedFrames, 1);257+ assert.equal(afterOverwrite.presenterQueueDepth, 1);258+ assert.equal(afterOverwrite.presenterQueueCapacity, 1);250259 251260 subject.advance(5);252261 newestLoad();
@@ -256,6 +265,8 @@ test('JPEG fallback presents only the newest frame when loads complete out of or
256265 assert.equal(afterNewest.presentPercentiles.count, 1);257266 assert.equal(afterNewest.presentPercentiles.p50, 5);258267 assert.equal(afterNewest.presentationDroppedFrames, 1);268+ assert.equal(afterNewest.presenterQueueDepth, 0);269+ assert.equal(afterNewest.presenterQueueCapacity, 1);259270 260271 subject.advance(100);261272 staleLoad();
@@ -294,6 +305,9 @@ test('JPEG fallback error callbacks affect only the current pending frame', () =
294305 const afterFailure = subject.pipeline.snapshot();295306 assert.equal(afterFailure.droppedFrames, 1);296307 assert.equal(afterFailure.presentedFrames, 0);308+ assert.equal(afterFailure.presentationDroppedFrames, 1);309+ assert.equal(afterFailure.presenterQueueDepth, 0);310+ assert.equal(afterFailure.presenterQueueCapacity, 1);297311 assert.deepEqual(subject.draws, []);298312 assert.deepEqual(subject.revokedUrls, [299313 'blob:test-frame-1',
@@ -322,6 +336,8 @@ test('JPEG fallback callbacks cannot survive a session reset', () => {
322336 assert.equal(stats.presentedFrames, 0);323337 assert.equal(stats.droppedFrames, 0);324338 assert.equal(stats.presentPercentiles.count, 0);339+ assert.equal(stats.presenterQueueDepth, 0);340+ assert.equal(stats.presenterQueueCapacity, 1);325341 assert.deepEqual(subject.draws, []);326342 assert.deepEqual(subject.revokedUrls, ['blob:test-frame-1']);327343 });