Skip to content

Instantly share code, notes, and snippets.

@DDRBoxman
Created December 8, 2020 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DDRBoxman/89342e582384cf88dcd69ac364c50ae7 to your computer and use it in GitHub Desktop.
Save DDRBoxman/89342e582384cf88dcd69ac364c50ae7 to your computer and use it in GitHub Desktop.
defer loading monitoring
From 76d6fd6bd4c16496b27455788922bf2572f59036 Mon Sep 17 00:00:00 2001
From: Colin Edwards <colin@recursivepenguin.com>
Date: Mon, 7 Dec 2020 18:49:00 -0600
Subject: [PATCH] Defer enabling monitoring
---
libobs/obs.c | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/libobs/obs.c b/libobs/obs.c
index 7d32dbe50..85d632344 100644
--- a/libobs/obs.c
+++ b/libobs/obs.c
@@ -1824,19 +1824,6 @@ static obs_source_t *obs_load_source_type(obs_data_t *source_data)
obs_source_set_deinterlace_field_order(
source, (enum obs_deinterlace_field_order)di_order);
- monitoring_type = (int)obs_data_get_int(source_data, "monitoring_type");
- if (prev_ver < MAKE_SEMANTIC_VERSION(23, 2, 2)) {
- if ((caps & OBS_SOURCE_MONITOR_BY_DEFAULT) != 0) {
- /* updates older sources to enable monitoring
- * automatically if they added monitoring by default in
- * version 24 */
- monitoring_type = OBS_MONITORING_TYPE_MONITOR_ONLY;
- obs_source_set_audio_mixers(source, 0x3F);
- }
- }
- obs_source_set_monitoring_type(
- source, (enum obs_monitoring_type)monitoring_type);
-
obs_data_release(source->private_settings);
source->private_settings =
obs_data_get_obj(source_data, "private_settings");
@@ -1916,6 +1903,28 @@ void obs_load_sources(obs_data_array_t *array, obs_load_source_cb cb,
obs_data_release(source_data);
}
+ for (i = 0; i < sources.num; i++) {
+ obs_source_t *source = sources.array[i];
+ obs_data_t *source_data = obs_data_array_item(array, i);
+ if (source) {
+ int monitoring_type = (int)obs_data_get_int(source_data, "monitoring_type");
+ uint32_t prev_ver = (uint32_t)obs_data_get_int(source_data, "prev_ver");
+ uint32_t caps = obs_source_get_output_flags(source);
+ if (prev_ver < MAKE_SEMANTIC_VERSION(23, 2, 2)) {
+ if ((caps & OBS_SOURCE_MONITOR_BY_DEFAULT) != 0) {
+ /* updates older sources to enable monitoring
+ * automatically if they added monitoring by default in
+ * version 24 */
+ monitoring_type = OBS_MONITORING_TYPE_MONITOR_ONLY;
+ obs_source_set_audio_mixers(source, 0x3F);
+ }
+ }
+ obs_source_set_monitoring_type(
+ source, (enum obs_monitoring_type)monitoring_type);
+ }
+ obs_data_release(source_data);
+ }
+
for (i = 0; i < sources.num; i++)
obs_source_release(sources.array[i]);
--
2.28.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment