diff --git a/obs/data/locale/en-US.ini b/obs/data/locale/en-US.ini index ac29a89b9..3253831bc 100644 --- a/obs/data/locale/en-US.ini +++ b/obs/data/locale/en-US.ini @@ -43,6 +43,7 @@ Untitled="Untitled" New="New" Duplicate="Duplicate" Enable="Enable" +HighResourceUsage="Encoding overloaded! Consider turning down video settings or using a faster encoding preset." # title bar strings TitleBar.Profile="Profile" diff --git a/obs/window-basic-status-bar.cpp b/obs/window-basic-status-bar.cpp index c9a590eae..5ad342737 100644 --- a/obs/window-basic-status-bar.cpp +++ b/obs/window-basic-status-bar.cpp @@ -40,9 +40,16 @@ void OBSBasicStatusBar::Activate() refreshTimer = new QTimer(this); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(UpdateStatusBar())); - totalSeconds = 0; - refreshTimer->start(1000); + int skipped = video_output_get_skipped_frames(obs_get_video()); + int total = video_output_get_total_frames(obs_get_video()); + + totalSeconds = 0; + lastSkippedFrameCount = 0; + startSkippedFrameCount = skipped; + startTotalFrameCount = total; + + refreshTimer->start(1000); active = true; } } @@ -244,6 +251,20 @@ void OBSBasicStatusBar::UpdateStatusBar() UpdateBandwidth(); UpdateSessionTime(); UpdateDroppedFrames(); + + int skipped = video_output_get_skipped_frames(obs_get_video()); + int total = video_output_get_total_frames(obs_get_video()); + + skipped -= startSkippedFrameCount; + total -= startTotalFrameCount; + + int diff = skipped - lastSkippedFrameCount; + double percentage = double(skipped) / double(total) * 100.0; + + if (diff && percentage >= 0.1f) + showMessage(QTStr("HighResourceUsage"), 4000); + + lastSkippedFrameCount = skipped; } void OBSBasicStatusBar::StreamDelayStarting(int sec) diff --git a/obs/window-basic-status-bar.hpp b/obs/window-basic-status-bar.hpp index af9a04bbe..8fb28505e 100644 --- a/obs/window-basic-status-bar.hpp +++ b/obs/window-basic-status-bar.hpp @@ -31,6 +31,10 @@ private: int delaySecStarting = 0; int delaySecStopping = 0; + int startSkippedFrameCount = 0; + int startTotalFrameCount = 0; + int lastSkippedFrameCount = 0; + int bitrateUpdateSeconds = 0; uint64_t lastBytesSent = 0; uint64_t lastBytesSentTime = 0;