Browse Source

libobs: Always render active audio sources when possible

Fixes an issue where audio data would not be popped if they were not
activated/presenting.  This would cause the audio subsystem to
needlessly buffer when they were reactivated again.  Rendering all audio
sources (excuding composite/filter sources) helps ensure that audio data
is always popped and not left to pile up.
jp9000 9 years ago
parent
commit
3988c6d4b6
1 changed files with 10 additions and 0 deletions
  1. 10 0
      libobs/obs-audio.c

+ 10 - 0
libobs/obs-audio.c

@@ -347,6 +347,16 @@ bool audio_callback(void *param,
 		}
 	}
 
+	pthread_mutex_lock(&data->audio_sources_mutex);
+
+	source = data->first_audio_source;
+	while (source) {
+		push_audio_tree(NULL, source, audio);
+		source = (struct obs_source*)source->next_audio_source;
+	}
+
+	pthread_mutex_unlock(&data->audio_sources_mutex);
+
 	/* ------------------------------------------------ */
 	/* render audio data */
 	for (size_t i = 0; i < audio->render_order.num; i++) {