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:
jp9000
2016-01-25 17:29:10 -08:00
parent 3749436cd5
commit e5fc4dbbcd
3 changed files with 28 additions and 2 deletions
+23 -2
View File
@@ -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)