UI: Fix screenshots preventing auto-remux

Due to the fact that a global was used on GenerateSpecifiedFilename to
save the remux file name, when a screenshot was made, it would overwrite
the filename being remuxed, because screenshots use the same function to
generate filenames as well.

This solves that problem by removing the global and the changes to
GeneratedSpecifiedFilename, and isolating that to the output handler.

Coincidentally, this bug probably also happened with replay buffers
under certain circumstances.

Fixes obsproject/obs-studio#3497
Closes obsproject/obs-studio#3498
This commit is contained in:
jp9000
2020-09-26 08:19:27 -07:00
parent d4ce406138
commit e5d8f345fc
5 changed files with 43 additions and 48 deletions

View File

@@ -5846,30 +5846,11 @@ void OBSBasic::StreamingStop(int code, QString last_error)
void OBSBasic::AutoRemux()
{
const char *mode = config_get_string(basicConfig, "Output", "Mode");
bool advanced = astrcmpi(mode, "Advanced") == 0;
QString input = outputHandler->lastRecordingPath.c_str();
if (input.isEmpty())
return;
const char *path = !advanced ? config_get_string(basicConfig,
"SimpleOutput",
"FilePath")
: config_get_string(basicConfig, "AdvOut",
"RecFilePath");
/* do not save if using FFmpeg output in advanced output mode */
if (advanced) {
const char *type =
config_get_string(basicConfig, "AdvOut", "RecType");
if (astrcmpi(type, "FFmpeg") == 0) {
return;
}
}
QString input;
input += path;
input += "/";
input += remuxFilename.c_str();
QFileInfo fi(remuxFilename.c_str());
QFileInfo fi(input);
QString suffix = fi.suffix();
/* do not remux if lossless */
@@ -5877,11 +5858,13 @@ void OBSBasic::AutoRemux()
return;
}
QString path = fi.path();
QString output = input;
output.resize(output.size() - suffix.size());
output += "mp4";
OBSRemux *remux = new OBSRemux(path, this, true);
OBSRemux *remux = new OBSRemux(QT_TO_UTF8(path), this, true);
remux->show();
remux->AutoRemux(input, output);
}
@@ -6019,8 +6002,7 @@ void OBSBasic::RecordingStop(int code, QString last_error)
if (diskFullTimer->isActive())
diskFullTimer->stop();
if (remuxAfterRecord)
AutoRemux();
AutoRemux();
OnDeactivate();
UpdatePause(false);