1
0
Эх сурвалжийг харах

obs-ffmpeg: Improved output error handling

Checks the output path is writable and checks for failure to start the
ffmpeg-mux subprocess.
Richard Stanway 8 жил өмнө
parent
commit
ca5f123030

+ 3 - 0
plugins/obs-ffmpeg/data/locale/en-US.ini

@@ -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."

+ 21 - 0
plugins/obs-ffmpeg/obs-ffmpeg-mux.c

@@ -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;
 	}