Explorar o código

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.
pkv %!s(int64=4) %!d(string=hai) anos
pai
achega
b46e9bba85
Modificáronse 1 ficheiros con 5 adicións e 6 borrados
  1. 5 6
      plugins/obs-filters/noise-suppress-filter.c

+ 5 - 6
plugins/obs-filters/noise-suppress-filter.c

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