From 971728a1a7c7fab3e9905bbfbc12696211360c84 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 30 Jan 2016 08:50:31 -0800 Subject: [PATCH] libobs: Fix variable being access outside of a mutex audio_input_buf should never be accessed outside of audio_buf_mutex. --- libobs/obs-source.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libobs/obs-source.c b/libobs/obs-source.c index 5ce734f59..7202408ef 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -3578,6 +3578,12 @@ static inline void process_audio_source_tick(obs_source_t *source, { pthread_mutex_lock(&source->audio_buf_mutex); + if (source->audio_input_buf[0].size < size) { + source->audio_pending = true; + pthread_mutex_unlock(&source->audio_buf_mutex); + return; + } + for (size_t ch = 0; ch < channels; ch++) circlebuf_peek_front(&source->audio_input_buf[ch], source->audio_output_buf[0][ch], @@ -3621,7 +3627,7 @@ void obs_source_audio_render(obs_source_t *source, uint32_t mixers, return; } - if (!source->audio_ts || source->audio_input_buf[0].size < size) { + if (!source->audio_ts) { source->audio_pending = true; return; }