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.
master
jp9000 2016-01-23 01:59:16 -08:00
parent 3749436cd5
commit e5fc4dbbcd
3 changed files with 28 additions and 2 deletions

View File

@ -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"

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)

View File

@ -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;