From 11131682b1ac9ebabf8917cc184c93068f22dec8 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Thu, 28 Mar 2024 16:43:12 -0400 Subject: [PATCH] UI: Check low disk space only if recording to a file The Custom FFmpeg Output allows the user to configure it to output to a URL instead of a file. In OBSBasic::StartRecording(), we unconditionally call LowDiskSpace() to check for low disk space because we assume that a "recording" will always be to disk. When os_get_free_disk_space() is called on a non-existent path, it returns 0, which causes OBS to emit a low disk space warning. Instead, only call DiskSpaceMessage() if not "recording" to a URL. --- UI/window-basic-main.cpp | 12 ++++++++++-- UI/window-basic-main.hpp | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index 29cf6982f..1e3ecd31a 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -7652,7 +7652,7 @@ void OBSBasic::StartRecording() return; } - if (LowDiskSpace()) { + if (!IsFFmpegOutputToURL() && LowDiskSpace()) { DiskSpaceMessage(); ui->recordButton->setChecked(false); return; @@ -10887,7 +10887,7 @@ void OBSBasic::OutputPathInvalidMessage() QTStr("Output.BadPath.Text")); } -bool OBSBasic::OutputPathValid() +bool OBSBasic::IsFFmpegOutputToURL() const { const char *mode = config_get_string(Config(), "Output", "Mode"); if (strcmp(mode, "Advanced") == 0) { @@ -10901,6 +10901,14 @@ bool OBSBasic::OutputPathValid() } } + return false; +} + +bool OBSBasic::OutputPathValid() +{ + if (IsFFmpegOutputToURL()) + return true; + const char *path = GetCurrentOutputPath(); return path && *path && QDir(path).exists(); } diff --git a/UI/window-basic-main.hpp b/UI/window-basic-main.hpp index a430f39cc..8c4104c11 100644 --- a/UI/window-basic-main.hpp +++ b/UI/window-basic-main.hpp @@ -881,6 +881,7 @@ private: void UpdatePause(bool activate = true); void UpdateReplayBuffer(bool activate = true); + bool IsFFmpegOutputToURL() const; bool OutputPathValid(); void OutputPathInvalidMessage();