Browse Source

libobs: Don't ignore starting audio if async

I when a source has both async audio/video capability, it would ignore
audio until the video has started.  There's really no need to do this,
when the video starts it'll just fix up the timing automatically.

This should fix the case where things like the media source would not be
able to play audio-only files.
jp9000 10 years ago
parent
commit
4fdd8fb570
1 changed files with 7 additions and 14 deletions
  1. 7 14
      libobs/obs-source.c

+ 7 - 14
libobs/obs-source.c

@@ -1691,23 +1691,16 @@ void obs_source_output_audio(obs_source_t *source,
 	output = filter_async_audio(source, &source->audio_data);
 
 	if (output) {
-		bool async = (flags & OBS_SOURCE_ASYNC) != 0;
+		struct audio_data data;
 
-		pthread_mutex_lock(&source->audio_mutex);
-
-		/* wait for video to start before outputting any audio so we
-		 * have a base for sync */
-		if (source->timing_set || !async) {
-			struct audio_data data;
+		for (int i = 0; i < MAX_AV_PLANES; i++)
+			data.data[i] = output->data[i];
 
-			for (int i = 0; i < MAX_AV_PLANES; i++)
-				data.data[i] = output->data[i];
-
-			data.frames    = output->frames;
-			data.timestamp = output->timestamp;
-			source_output_audio_line(source, &data);
-		}
+		data.frames    = output->frames;
+		data.timestamp = output->timestamp;
 
+		pthread_mutex_lock(&source->audio_mutex);
+		source_output_audio_line(source, &data);
 		pthread_mutex_unlock(&source->audio_mutex);
 	}