From 7580d00d2b8c60aaf27fdfa232eb202681728b9f Mon Sep 17 00:00:00 2001 From: Alex P Date: Tue, 25 Nov 2025 00:04:40 +0200 Subject: [PATCH] Fix HDMI hotplug video restart after sleep mode changes The sleep mode feature from dev (PR #999) prevented video from auto-starting when streaming_status == 0, which broke HDMI hotplug functionality. Modified video_restart_streaming() to check detected_signal: - No signal + not streaming -> don't start (preserve sleep mode) - Has signal -> always stop cleanly then restart (fix hotplug) This ensures proper encoder cleanup and prevents corrupted video output after HDMI disconnect/reconnect cycles. --- internal/native/cgo/video.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/native/cgo/video.c b/internal/native/cgo/video.c index 5520658e..e362684c 100644 --- a/internal/native/cgo/video.c +++ b/internal/native/cgo/video.c @@ -769,20 +769,19 @@ uint8_t video_get_streaming_status() { void video_restart_streaming() { uint8_t streaming_status = video_get_streaming_status(); - if (streaming_status == 0) - { - log_info("will not restart video streaming because it's stopped"); - return; - } - if (streaming_status == 2) { + if (streaming_status == 0 && !detected_signal) { + return; + } + + if (streaming_status != 0) { video_stop_streaming(); } if (!wait_for_streaming_stopped()) { return; } - + video_start_streaming(); }