obs-filters: Fix initialization of RTX denoiser

This fixes issue #4441.
The issue occurs when adding the noise suppression filter for the
first time. Rnnoise or speex are the default noise suppression
methods. Line 344 returns which prevents initialization and
allocation for nvafx (rtx denoiser).
With the fix, initialization of nvafx occurs when swapping methods.
This commit is contained in:
pkv
2021-04-04 22:00:14 +02:00
committed by Jim
parent 84b4257276
commit b46e9bba85

View File

@@ -336,18 +336,17 @@ static void noise_suppress_update(void *data, obs_data_t *s)
/* Ignore if already allocated */
#if defined(LIBSPEEXDSP_ENABLED)
if (ng->spx_states[0])
return;
#endif
#ifdef LIBRNNOISE_ENABLED
if (ng->rnn_states[0])
if (!ng->use_rnnoise && !ng->use_nvafx && ng->spx_states[0])
return;
#endif
#ifdef LIBNVAFX_ENABLED
if (ng->handle[0])
if (ng->use_nvafx && ng->handle[0])
return;
#endif
#ifdef LIBRNNOISE_ENABLED
if (ng->use_rnnoise && ng->rnn_states[0])
return;
#endif
/* One speex/rnnoise state for each channel (limit 2) */
ng->copy_buffers[0] = bmalloc(frames * channels * sizeof(float));
#ifdef LIBSPEEXDSP_ENABLED