Complete VIDEO-001 through VIDEO-004 software video studies

This commit is contained in:
LittleSam129
2026-09-16 18:27:35 +03:00
parent af7c05f2da
commit 95f664076a
403 changed files with 392009 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
"""Детерминированность модели и запрет позднего видеофрагмента."""
from __future__ import annotations
import json
from protocol.video_stream_transport import FrameReassembler, FrameType, VideoFragment
from tools.video004_transport import (
BASELINE_160, BASELINE_320, CODEC_RESULTS, _frames, simulate,
)
def test_v2_fragment_can_enter_reassembler_without_reserialization() -> None:
receiver = FrameReassembler(19, 1012, max_age_ms=300)
fragment = VideoFragment(19, 0, 0, 1, FrameType.KEYFRAME, 10, b"h264")
completed = receiver.offer_fragment(fragment, 10)
assert completed is not None and completed.data == b"h264"
assert receiver.offer_fragment(fragment, 11) is None
def test_loss_model_repeats_and_zero_loss_shows_all_normal_frames() -> None:
codec = json.loads(CODEC_RESULTS.read_text(encoding="utf-8"))
baseline = json.loads(BASELINE_320.read_text(encoding="utf-8"))
baseline_160 = json.loads(BASELINE_160.read_text(encoding="utf-8"))
combined, _ = _frames("NORMAL", 640, 360, 10, baseline["windows"][0],
codec, baseline_160)
frames = [frame for frame in combined if frame.stream_id == 0x56303334]
clean = simulate(frames, 10, "2/3", 8, 1, ("random", 0))
first = simulate(frames, 10, "2/3", 8, 2, ("random", 5))
second = simulate(frames, 10, "2/3", 8, 2, ("random", 5))
assert clean["displayed_frames"] == clean["input_frames"] == 60
assert first == second
assert first["parity_recoveries"] > 0
assert first["no_old_frame_replay"]