Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(appshot): build HDR frames with PyAV 15 on Apple Silicon
rubenluetke10-beep0322b3d2d811
diff --git a/jarvis/appshot/hdr_recording.py b/jarvis/appshot/hdr_recording.pyindex f020ddc225..dd3b20fbb4 100644--- a/jarvis/appshot/hdr_recording.py+++ b/jarvis/appshot/hdr_recording.py@@ -77,7 +77,12 @@ def p010_frame(av: Any, pixel_format: str, y: Any, uv: Any) -> Any:fill(frame.planes[0], y >> 6)fill(frame.planes[1], uv[..., 0] >> 6)fill(frame.planes[2], uv[..., 1] >> 6)- tag_hdr10(frame)+ try:+ tag_hdr10(frame)+ except AttributeError:+ # PyAV before 16 (pinned on Apple Silicon) has no colour properties on+ # a VideoFrame; the encoder's own tags still mark the stream as HDR10.+ log.debug("appshot: this PyAV cannot tag frames; the encoder tags the stream")return framediff --git a/tests/unit/appshot/test_hdr_recording.py b/tests/unit/appshot/test_hdr_recording.pyindex ace609382d..639b2cb05f 100644--- a/tests/unit/appshot/test_hdr_recording.py+++ b/tests/unit/appshot/test_hdr_recording.py@@ -23,14 +23,36 @@ def test_p010_frame_keeps_every_code_and_is_tagged_hdr10(pixel_format: str) -> Ny, uv = _planes()frame = hdr_recording.p010_frame(av, pixel_format, y, uv)assert (frame.width, frame.height, frame.format.name) == (8, 4, pixel_format)- assert (frame.color_primaries, frame.color_trc, frame.colorspace, frame.color_range) == (- 9, 16, 9, 1- )+ # PyAV before 16 (Apple Silicon pin) has no frame colour properties; the+ # frame is still built and the encoder carries the tags.+ if hasattr(av.VideoFrame, "color_primaries"):+ assert (frame.color_primaries, frame.color_trc, frame.colorspace, frame.color_range) == (+ 9, 16, 9, 1+ )back = frame.reformat(format="p010le")luma = np.frombuffer(back.planes[0], np.uint16).reshape(4, -1)[:, :8]assert np.array_equal(luma >> 6, y >> 6)+def test_a_pyav_without_frame_colour_tags_still_builds_the_frame() -> None:+ """PyAV 15 (pinned on Apple Silicon) cannot tag a VideoFrame; that is no crash."""++ class Plane(bytearray):+ line_size = 16 # 8 pixels x 2 bytes++ class OldFrame:+ __slots__ = ("planes",) # no colour properties, like PyAV 15++ def __init__(self, width: int, height: int, _format: str) -> None:+ self.planes = [Plane(height * 16), Plane(height // 2 * 16)]++ y, uv = _planes()+ frame = hdr_recording.p010_frame(type("av", (), {"VideoFrame": OldFrame}), "p010le", y, uv)++ luma = np.frombuffer(frame.planes[0], np.uint16).reshape(4, 8)+ assert np.array_equal(luma, y)++def test_sdr_monitors_and_other_platforms_keep_the_8_bit_path(monkeypatch) -> None:monkeypatch.setattr(sys, "platform", "linux")assert hdr_recording.choose_hdr_capture(1234, (0, 0, 1, 1), "1080p", 60) is None