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) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-29 13:14:08 +10:00
1 parent 0e8b699fcd
commit dac9dbce6e
2 files changed
+16 -5

No files matched your search

+7
View File
@@ -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')
+9 -5
View File
@@ -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: