feat(v1): add replayable video source

This commit is contained in:
ila
2026-07-21 09:49:28 +08:00
parent f5a7ec7412
commit d4eb11b909
8 changed files with 330 additions and 14 deletions
+5 -5
View File
@@ -132,7 +132,7 @@ git commit -m "feat(v1): add secure configuration baseline"
- Create: `v1/video_source.py`
- Create: `v1/tests/test_video_source.py`
- [ ] **Step 1: Write replay and broken-source tests**
- [x] **Step 1: Write replay and broken-source tests**
```python
def test_file_source_emits_monotonic_timestamps(sample_video):
@@ -146,12 +146,12 @@ def test_missing_source_returns_error_state(tmp_path):
assert source.read().status == SourceStatus.ERROR
```
- [ ] **Step 2: Run tests to verify they fail**
- [x] **Step 2: Run tests to verify they fail**
Run: `python -m pytest v1/tests/test_video_source.py -v`
Expected: FAIL because `VideoSource` and `SourceStatus` do not exist.
- [ ] **Step 3: Implement the source contract**
- [x] **Step 3: Implement the source contract**
```python
from typing import Optional
@@ -172,12 +172,12 @@ class FramePacket:
`read()` returns an error packet for failures; it never emits a synthetic person or fall event. For RTSP, reconnect with bounded backoff from configuration.
- [ ] **Step 4: Run tests**
- [x] **Step 4: Run tests**
Run: `python -m pytest v1/tests/test_video_source.py -v`
Expected: PASS.
- [ ] **Step 5: Commit**
- [x] **Step 5: Commit**
```powershell
git add v1/video_source.py v1/tests/test_video_source.py docs progress.md