From dac9dbce6e64392021a2682a4257064745434bb1 Mon Sep 17 00:00:00 2001 From: saphid <4596216+saphid@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:08:57 +1000 Subject: [PATCH] Play without the theatre surround if SteamVR refuses it Review (SWE-2 Max): a non-standby error creating the cosmetic surround at startup still ended playback before the screen appeared. Theatre now logs it and plays without the surround. close() treats any per-overlay teardown error as best effort (signals are already ignored there). Co-Authored-By: Claude Opus 5.5 (1M context) --- tests/test_media.py | 7 +++++++ ui/frame_media_player.py | 14 +++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/test_media.py b/tests/test_media.py index 606f1fb..f070b27 100644 --- a/tests/test_media.py +++ b/tests/test_media.py @@ -135,6 +135,13 @@ class Media(unittest.TestCase): self.assertEqual(result['dropped'], 2) self.assertIn((0, 1, 1), calls[3:]) + def test_theatre_surround_failure_does_not_stop_playback(self): + def fail_surround(n): + if n == 1: # the surround's upload is the first pixels call + raise RuntimeError('OpenVR SetOverlayRaw failed: 11') + result, _ = self.play_with('clip_SBS.mp4', on_pixels=fail_surround) + self.assertEqual((result['state'], result['frames']), ('ended', 4)) + def test_stop_mid_video_reports_stopped(self): result, _ = self.play_with('clip_SBS.mp4', on_pixels=lambda n: n == 3 and stop_now()) self.assertEqual(result['state'], 'stopped') diff --git a/ui/frame_media_player.py b/ui/frame_media_player.py index 9ce0529..d1c9e72 100644 --- a/ui/frame_media_player.py +++ b/ui/frame_media_player.py @@ -92,7 +92,7 @@ class Overlay: for h in reversed(self.handles): try: self.call('DestroyOverlay', h) - except RuntimeError: + except Exception: # signals are already ignored here, so Stop isn't lost pass finally: self.vr.VR_ShutdownInternal() @@ -207,10 +207,14 @@ def play(args): try: vr = Overlay() if args.theatre: - surround = vr.create('framecontrol.media.surround', 40, 4, order=0) - vr.call('SetOverlayAlpha', surround, .85) - if not show(surround, b'\x00\x00\x00\xff', 1, 1): - pending.append((surround, b'\x00\x00\x00\xff', 1, 1)) + try: + surround = vr.create('framecontrol.media.surround', 40, 4, order=0) + vr.call('SetOverlayAlpha', surround, .85) + if not show(surround, b'\x00\x00\x00\xff', 1, 1): + pending.append((surround, b'\x00\x00\x00\xff', 1, 1)) + except RuntimeError as e: + # Cosmetic: play without the dark surround rather than not at all. + print('Theatre surround unavailable: %s' % e, flush=True) screen = vr.create('framecontrol.media.screen', 3 if args.theatre else 1.6, 2, plan['layout'] != 'mono', aspect) if splat: