libobs: Always reset last audio buf size when it changes

This variable is used to detect whether audio has stopped -- if audio
stops, it detects that no new data is coming in, and resets the audio
position so that it eliminates the chance of causing the audio buffering
to go haywire if audio starts up again.  However, this variable was not
being reset every time the value changes, which it should.
This commit is contained in:
jp9000
2016-01-31 14:04:54 -08:00
parent 6407707a04
commit d2f2783b44
2 changed files with 10 additions and 0 deletions

View File

@@ -88,6 +88,7 @@ static void ignore_audio(obs_source_t *source, size_t channels,
circlebuf_pop_front(&source->audio_input_buf[ch], NULL,
source->audio_input_buf[ch].size);
source->last_audio_input_buf_size = 0;
source->audio_ts += (uint64_t)num_floats * 1000000000ULL /
(uint64_t)sample_rate;
}
@@ -198,6 +199,8 @@ static inline void discard_audio(struct obs_core_audio *audio,
for (size_t ch = 0; ch < channels; ch++)
circlebuf_pop_front(&source->audio_input_buf[ch], NULL, size);
source->last_audio_input_buf_size = 0;
#if DEBUG_AUDIO == 1
if (is_audio_source)
blog(LOG_DEBUG, "audio discarded, new ts: %"PRIu64,