refactor(viewer): profile rerun loading by playback stage
This commit is contained in:
@@ -11,7 +11,11 @@ let recordedMediaSeekableCoverage;
|
||||
let recordedMediaFragmentUrl;
|
||||
let recordedMediaDecodeStartSequence;
|
||||
let recordedMediaSegmentAppendOrder;
|
||||
let recordedMediaSegmentSequenceAtTime;
|
||||
let recordedMediaCanRollTarget;
|
||||
let nextRecordedMediaRandomAccessSequence;
|
||||
let recordedMediaRecoveryTargetSequence;
|
||||
let selectRecordedMediaPreparationEpoch;
|
||||
|
||||
before(async () => {
|
||||
server = await createServer({
|
||||
@@ -26,7 +30,11 @@ before(async () => {
|
||||
recordedMediaFragmentUrl,
|
||||
recordedMediaDecodeStartSequence,
|
||||
recordedMediaSegmentAppendOrder,
|
||||
recordedMediaSegmentSequenceAtTime,
|
||||
recordedMediaCanRollTarget,
|
||||
nextRecordedMediaRandomAccessSequence,
|
||||
recordedMediaRecoveryTargetSequence,
|
||||
selectRecordedMediaPreparationEpoch,
|
||||
} = await server.ssrLoadModule("/src/components/RecordedFmp4Player.tsx"));
|
||||
});
|
||||
|
||||
@@ -161,7 +169,7 @@ test("decoded duration and seekable range cover the complete declared epoch", ()
|
||||
assert.equal(recordedMediaSeekableCoverage(20, 20, 20, 1, 1.01), false);
|
||||
});
|
||||
|
||||
test("recorded player keeps full-archive range fallback and uses bounded generation-bound fragments", async () => {
|
||||
test("production replay derives bounded fragments and retains native range fallback", async () => {
|
||||
const source = await readFile(
|
||||
new URL("../src/components/RecordedFmp4Player.tsx", import.meta.url),
|
||||
"utf8",
|
||||
@@ -176,6 +184,10 @@ test("recorded player keeps full-archive range fallback and uses bounded generat
|
||||
assert.match(source, /hasPresentedFrame/);
|
||||
assert.match(source, /retainForwardFrame/);
|
||||
assert.match(source, /candidateTarget\.sequence >= previousTarget\.sequence/);
|
||||
assert.match(source, /effectiveSegmentCount = segmentCount \?\? epoch\?\.segmentCount \?\? null/);
|
||||
assert.match(source, /requestedSegmentSequence = segmentSequence \?\?/);
|
||||
assert.match(source, /waitForRecordedVideoInitialFrame/);
|
||||
assert.match(source, /setSegmentRecoveryGeneration/);
|
||||
|
||||
assert.equal(recordedMediaDecodeStartSequence([1, 1491, 1501], 1500), 1491);
|
||||
assert.deepEqual(
|
||||
@@ -209,6 +221,44 @@ test("recorded player keeps full-archive range fallback and uses bounded generat
|
||||
);
|
||||
});
|
||||
|
||||
test("production replay derives its bounded fragment directly from the source clock", () => {
|
||||
const ends = [0.101, 0.185, 0.286, 0.401];
|
||||
const epochStart = 39.215263458;
|
||||
assert.equal(recordedMediaSegmentSequenceAtTime(ends, epochStart, epochStart), 1);
|
||||
assert.equal(recordedMediaSegmentSequenceAtTime(ends, epochStart, epochStart + 0.101), 1);
|
||||
assert.equal(recordedMediaSegmentSequenceAtTime(ends, epochStart, epochStart + 0.103), 2);
|
||||
assert.equal(recordedMediaSegmentSequenceAtTime(ends, epochStart, epochStart + 0.4), 4);
|
||||
assert.equal(recordedMediaSegmentSequenceAtTime(ends, epochStart, epochStart + 1), null);
|
||||
});
|
||||
|
||||
test("a corrupt fragment advances recovery to the next random-access frame", () => {
|
||||
assert.equal(nextRecordedMediaRandomAccessSequence([1, 11, 21, 49], 1), 11);
|
||||
assert.equal(nextRecordedMediaRandomAccessSequence([1, 11, 21, 49], 20), 21);
|
||||
assert.equal(nextRecordedMediaRandomAccessSequence([1, 11, 21, 49], 49), null);
|
||||
assert.equal(nextRecordedMediaRandomAccessSequence([1, 11, 21, 49], 0), null);
|
||||
});
|
||||
|
||||
test("paused seek displays the recovery keyframe until the source clock leaves the corrupt GOP", () => {
|
||||
assert.equal(recordedMediaRecoveryTargetSequence(120, 120, 149), 149);
|
||||
assert.equal(recordedMediaRecoveryTargetSequence(130, 120, 149), 149);
|
||||
assert.equal(recordedMediaRecoveryTargetSequence(119, 120, 149), 119);
|
||||
assert.equal(recordedMediaRecoveryTargetSequence(149, 120, 149), 149);
|
||||
assert.equal(recordedMediaRecoveryTargetSequence(151, 120, 149), 151);
|
||||
assert.equal(recordedMediaRecoveryTargetSequence(null, 120, 149), null);
|
||||
assert.equal(recordedMediaRecoveryTargetSequence(120, null, null), 120);
|
||||
});
|
||||
|
||||
test("camera admission selects one bounded epoch while the shared clock is outside video", () => {
|
||||
const epochs = [
|
||||
{ ordinal: 1, timelineStartSeconds: 39, timelineEndSeconds: 100 },
|
||||
{ ordinal: 2, timelineStartSeconds: 120, timelineEndSeconds: 180 },
|
||||
];
|
||||
assert.equal(selectRecordedMediaPreparationEpoch(epochs, 0).ordinal, 1);
|
||||
assert.equal(selectRecordedMediaPreparationEpoch(epochs, 70).ordinal, 1);
|
||||
assert.equal(selectRecordedMediaPreparationEpoch(epochs, 110).ordinal, 2);
|
||||
assert.equal(selectRecordedMediaPreparationEpoch(epochs, 200).ordinal, 2);
|
||||
});
|
||||
|
||||
test("recorded player preserves forward rolling playback but seeks backward clip loops", () => {
|
||||
assert.equal(recordedMediaCanRollTarget(20, 21, true, true), true);
|
||||
assert.equal(recordedMediaCanRollTarget(20, 20, true, true), true);
|
||||
|
||||
Reference in New Issue
Block a user