mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
UI: Warn if high resource usage when encoding
Shows a warning stating that encoding is stalling, and shows the number and percentage of frames that were skipped due to encoding.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user