libobs: Fix bug (source resampler not resetting)

If the audio data had the same format/samplerate as the obs audio
subsystem, it would fail to simply destroy the resampler and set it to
NULL, and then any audio data going through would use the resampler that
was being used before that, causing audio to become garbage.

This bug only started appearing when I recently changed the libobs
internal audio subsystem format to non-interleaved floating point, which
is a common format, and thus caused this bug to actually occur more
often.
This commit is contained in:
jp9000 2015-03-13 01:03:01 -07:00
parent 4fdd8fb570
commit 0f31880c3c

View File

@ -1575,6 +1575,9 @@ static inline void reset_resampler(obs_source_t *source,
source->sample_info.samples_per_sec = audio->samples_per_sec;
source->sample_info.speakers = audio->speakers;
audio_resampler_destroy(source->resampler);
source->resampler = NULL;
if (source->sample_info.samples_per_sec == obs_info->samples_per_sec &&
source->sample_info.format == obs_info->format &&
source->sample_info.speakers == obs_info->speakers) {
@ -1582,7 +1585,6 @@ static inline void reset_resampler(obs_source_t *source,
return;
}
audio_resampler_destroy(source->resampler);
source->resampler = audio_resampler_create(&output_info,
&source->sample_info);