fix(studio): 消除 Finger 实时采集的帧排队

实时处理相机最新帧,并修复重复采样、数组快照和暂停恢复。通过共享模块及相关 Studio 测试。
This commit is contained in:
ykcheungab
2026-10-12 21:14:33 +08:00
parent d06501d7d5
commit 5a3ca51b29
3 changed files with 179 additions and 30 deletions
@@ -283,6 +283,8 @@ def test_finger_video_and_camera_use_the_same_packet_path(source, monkeypatch):
assert opened == [source]
assert packets
packet = packets[0]
assert packet.valid
assert packet.force_calibrated
assert packet.raw_frame.shape == (8, 8, 3)
assert packet.processed_frame.shape == (8, 8, 3)
assert packet.session_id == 1
@@ -300,20 +302,25 @@ def test_finger_video_and_camera_use_the_same_packet_path(source, monkeypatch):
_restore(saved)
@pytest.mark.parametrize("kind", ["box", "finger"])
def test_a_stopped_session_leaves_no_pipeline_threads(kind):
@pytest.mark.parametrize(
"kind, source", [("box", "0"), ("finger", "recording.mp4"), ("finger", 0)]
)
def test_a_stopped_session_leaves_no_pipeline_threads(kind, source):
"""``stop`` must join the three stages: they own the sensor's tracker state."""
packets: list = []
saved = _install()
worker = _worker(kind)
try:
worker.add_sink(packets.append)
worker.start("0", config_ref=_config(kind))
worker.start(source, config_ref=_config(kind))
deadline = time.perf_counter() + 5.0
while time.perf_counter() < deadline and not packets:
time.sleep(0.02)
assert packets, "the session published nothing to stop"
assert _pipeline_threads(), "the fake session did not start the pipeline"
if kind == "finger" and source == 0:
assert _pipeline_threads() == []
else:
assert _pipeline_threads(), "the fake session did not start the pipeline"
worker.stop(wait=True)
deadline = time.perf_counter() + 5.0
while time.perf_counter() < deadline and _pipeline_threads():