浏览代码

UI: Log generic stream startup failures

These code paths had no logging on failure, resulting in a log file that
would confuse people attempting to perform support for users.
jp9000 8 年之前
父节点
当前提交
720a28aeb9
共有 1 个文件被更改,包括 22 次插入2 次删除
  1. 22 2
      UI/window-basic-main-outputs.cpp

+ 22 - 2
UI/window-basic-main-outputs.cpp

@@ -664,8 +664,11 @@ bool SimpleOutput::StartStreaming(obs_service_t *service)
 
 		streamOutput = obs_output_create(type, "simple_stream",
 				nullptr, nullptr);
-		if (!streamOutput)
+		if (!streamOutput) {
+			blog(LOG_WARNING, "Creation of stream output type '%s' "
+					"failed!", type);
 			return false;
+		}
 		obs_output_release(streamOutput);
 
 		streamDelayStarting.Connect(
@@ -756,6 +759,13 @@ bool SimpleOutput::StartStreaming(obs_service_t *service)
 		return true;
 	}
 
+	const char *error = obs_output_get_last_error(streamOutput);
+	bool has_last_error = error && *error;
+
+	blog(LOG_WARNING, "Stream output type '%s' failed to start!%s%s",
+			type,
+			has_last_error ? "  Last Error: " : "",
+			has_last_error ? error : "");
 	return false;
 }
 
@@ -1417,8 +1427,11 @@ bool AdvancedOutput::StartStreaming(obs_service_t *service)
 
 		streamOutput = obs_output_create(type, "adv_stream",
 				nullptr, nullptr);
-		if (!streamOutput)
+		if (!streamOutput) {
+			blog(LOG_WARNING, "Creation of stream output type '%s' "
+					"failed!", type);
 			return false;
+		}
 		obs_output_release(streamOutput);
 
 		streamDelayStarting.Connect(
@@ -1509,6 +1522,13 @@ bool AdvancedOutput::StartStreaming(obs_service_t *service)
 		return true;
 	}
 
+	const char *error = obs_output_get_last_error(streamOutput);
+	bool has_last_error = error && *error;
+
+	blog(LOG_WARNING, "Stream output type '%s' failed to start!%s%s",
+			type,
+			has_last_error ? "  Last Error: " : "",
+			has_last_error ? error : "");
 	return false;
 }