From 946981c222df81c8ae3c2b87c988e446910995ca Mon Sep 17 00:00:00 2001 From: Siyuan Date: Fri, 17 Oct 2025 14:53:44 +0000 Subject: [PATCH] chore: do not restart video streaming if the format is the same --- internal/native/cgo/video.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/native/cgo/video.c b/internal/native/cgo/video.c index e6add58f..917e9163 100644 --- a/internal/native/cgo/video.c +++ b/internal/native/cgo/video.c @@ -793,12 +793,18 @@ void *run_detect_format(void *arg) (dv_timings.bt.width + dv_timings.bt.hfrontporch + dv_timings.bt.hsync + dv_timings.bt.hbackporch)); log_info("Frames per second: %.2f fps", frames_per_second); + + bool should_restart = dv_timings.bt.width != detected_width || dv_timings.bt.height != detected_height || !detected_signal; + detected_width = dv_timings.bt.width; detected_height = dv_timings.bt.height; detected_signal = true; video_report_format(true, NULL, detected_width, detected_height, frames_per_second); - video_restart_streaming(); + if (should_restart) { + log_info("restarting video streaming due to format change"); + video_restart_streaming(); + } } memset(&ev, 0, sizeof(ev));