obs-ffmpeg: Improved output error handling

Checks the output path is writable and checks for failure to start the
ffmpeg-mux subprocess.
This commit is contained in:
Richard Stanway
2017-08-07 00:20:54 +02:00
parent f9565febdf
commit ca5f123030
2 changed files with 24 additions and 0 deletions

View File

@@ -44,3 +44,6 @@ MediaFileFilter.AllFiles="All Files"
ReplayBuffer="Replay Buffer"
ReplayBuffer.Save="Save Replay"
HelperProcessFailed="Unable to start the recording helper process. Check that OBS files have not been blocked or removed by any 3rd party antivirus / security software."
UnableToWritePath="Unable to write to %1. Make sure you're using a recording path which your user account is allowed to write to and that there is sufficient disk space."

View File

@@ -282,10 +282,31 @@ static bool ffmpeg_mux_start(void *data)
settings = obs_output_get_settings(stream->output);
path = obs_data_get_string(settings, "path");
/* ensure output path is writable to avoid generic error message */
/* TODO: remove once ffmpeg-mux is refactored to pass errors back */
FILE *test_file = os_fopen(path, "wb");
if (!test_file) {
struct dstr error_message;
dstr_init_copy(&error_message,
obs_module_text("UnableToWritePath"));
dstr_replace(&error_message, "%1", path);
obs_output_set_last_error(stream->output,
error_message.array);
dstr_free(&error_message);
obs_data_release(settings);
return false;
}
fclose(test_file);
os_unlink(path);
start_pipe(stream, path);
obs_data_release(settings);
if (!stream->pipe) {
obs_output_set_last_error(stream->output,
obs_module_text("HelperProcessFailed"));
warn("Failed to create process pipe");
return false;
}