瀏覽代碼

libobs: Allow deferred source udpate on create

This allows sources to optionally defer update on creation in order to
prevent updates from being called from threads other than the video
thread.
jp9000 11 年之前
父節點
當前提交
1343d6bdee
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      libobs/obs-source.c

+ 7 - 7
libobs/obs-source.c

@@ -364,14 +364,14 @@ void obs_source_update(obs_source_t source, obs_data_t settings)
 {
 	if (!source) return;
 
-	obs_data_apply(source->context.settings, settings);
+	if (settings)
+		obs_data_apply(source->context.settings, settings);
 
-	if (source->context.data && source->info.update) {
-		if (source->info.output_flags & OBS_SOURCE_VIDEO)
-			source->defer_update = true;
-		else
-			source->info.update(source->context.data,
-					source->context.settings);
+	if (source->info.output_flags & OBS_SOURCE_VIDEO) {
+		source->defer_update = true;
+	} else if (source->context.data && source->info.update) {
+		source->info.update(source->context.data,
+				source->context.settings);
 	}
 }