UI: Initialize Stats window values after OBSInit/reset
When the statistics window starts up for the first time, it reset values at that very moment so that stray lagged frames due to OBS' startup wouldn't be displayed. However, that's really a bad place to reset those values because the user could want to view the stats window after a long stream, and having those values reset when he/she views the window for the first time would sort of make the point of viewing your stats moot. Instead, reset the values only when applicable, such as after OBSInit or when video is reset.
This commit is contained in:
@@ -1463,6 +1463,8 @@ void OBSBasic::OBSInit()
|
||||
|
||||
if (config_get_bool(basicConfig, "General", "OpenStatsOnStartup"))
|
||||
on_stats_triggered();
|
||||
|
||||
OBSBasicStats::InitializeValues();
|
||||
}
|
||||
|
||||
void OBSBasic::InitHotkeys()
|
||||
@@ -2772,6 +2774,8 @@ int OBSBasic::ResetVideo()
|
||||
ResizeProgram(ovi.base_width, ovi.base_height);
|
||||
}
|
||||
|
||||
OBSBasicStats::InitializeValues();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -217,6 +217,15 @@ static uint32_t first_skipped = 0xFFFFFFFF;
|
||||
static uint32_t first_rendered = 0xFFFFFFFF;
|
||||
static uint32_t first_lagged = 0xFFFFFFFF;
|
||||
|
||||
void OBSBasicStats::InitializeValues()
|
||||
{
|
||||
video_t *video = obs_get_video();
|
||||
first_encoded = video_output_get_total_frames(video);
|
||||
first_skipped = video_output_get_skipped_frames(video);
|
||||
first_rendered = obs_get_total_frames();
|
||||
first_lagged = obs_get_lagged_frames();
|
||||
}
|
||||
|
||||
void OBSBasicStats::Update()
|
||||
{
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
|
||||
|
@@ -57,4 +57,6 @@ class OBSBasicStats : public QWidget {
|
||||
public:
|
||||
OBSBasicStats(QWidget *parent = nullptr);
|
||||
~OBSBasicStats();
|
||||
|
||||
static void InitializeValues();
|
||||
};
|
||||
|
Reference in New Issue
Block a user