diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs index 6c70a47..a7796ac 100644 --- a/ViewModels/MainViewModel.cs +++ b/ViewModels/MainViewModel.cs @@ -501,18 +501,22 @@ public partial class MainViewModel : ViewModelBase if (element is Source { Type: SourceType.AlertBox } alert) { var now = DateTime.UtcNow; - if (now - _lastAlertResolveLog >= TimeSpan.FromSeconds(1)) + bool hasFrame = frame != null; + bool wasLoggedThisState = hasFrame == _lastAlertHadFrame; + if (!wasLoggedThisState || now - _lastAlertResolveLog >= TimeSpan.FromSeconds(10)) { + _lastAlertHadFrame = hasFrame; _lastAlertResolveLog = now; - AppLog.Write(frame == null - ? $"Output resolver: alert box '{alert.Id}' frame is null (visible={alert.IsVisible} playing={_alertLayer.IsPlaying}) — skipped in composite" - : $"Output resolver: alert box '{alert.Id}' frame {frame!.Width}x{frame!.Height} (visible={alert.IsVisible} playing={_alertLayer.IsPlaying})"); + AppLog.Write(hasFrame + ? $"Output resolver: alert box '{alert.Id}' frame {frame!.Width}x{frame!.Height} (visible={alert.IsVisible} playing={_alertLayer.IsPlaying})" + : $"Output resolver: alert box '{alert.Id}' frame is null (visible={alert.IsVisible} playing={_alertLayer.IsPlaying}) — skipped in composite"); } } return frame; } private DateTime _lastAlertResolveLog = DateTime.MinValue; + private bool _lastAlertHadFrame = false; private DateTime _lastWebcamNullLog = DateTime.MinValue;