Utils: Use output path util instead of hacky method

We still have to wait for a new OBS version to be released before this
will work, but to be fair it was pretty broken in the previous state.
This commit is contained in:
tt2468 2021-12-21 02:30:18 -08:00
parent a898bacd79
commit b331f76d40

View File

@ -27,15 +27,13 @@ json Utils::Obs::ObjectHelper::GetStats()
{
json ret;
config_t* currentProfile = obs_frontend_get_profile_config();
const char* outputMode = config_get_string(currentProfile, "Output", "Mode");
const char* recordPath = strcmp(outputMode, "Advanced") ? config_get_string(currentProfile, "SimpleOutput", "FilePath") : config_get_string(currentProfile, "AdvOut", "RecFilePath");
std::string outputPath = Utils::Obs::StringHelper::GetCurrentRecordOutputPath();
video_t* video = obs_get_video();
ret["cpuUsage"] = os_cpu_usage_info_query(GetCpuUsageInfo());
ret["memoryUsage"] = (double)os_get_proc_resident_size() / (1024.0 * 1024.0);
ret["availableDiskSpace"] = (double)os_get_free_disk_space(recordPath) / (1024.0 * 1024.0);
ret["availableDiskSpace"] = (double)os_get_free_disk_space(outputPath.c_str()) / (1024.0 * 1024.0);
ret["activeFps"] = obs_get_active_fps();
ret["averageFrameRenderTime"] = (double)obs_get_average_frame_time_ns() / 1000000.0;
ret["renderSkippedFrames"] = obs_get_lagged_frames();