Ver Fonte

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 há 4 anos atrás
pai
commit
b46e9bba85
1 ficheiros alterados com 5 adições e 6 exclusões
  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 */
 #if defined(LIBSPEEXDSP_ENABLED)
-	if (ng->spx_states[0])
+	if (!ng->use_rnnoise && !ng->use_nvafx && ng->spx_states[0])
 		return;
 #endif
-#ifdef LIBRNNOISE_ENABLED
-	if (ng->rnn_states[0])
+#ifdef LIBNVAFX_ENABLED
+	if (ng->use_nvafx && ng->handle[0])
 		return;
 #endif
-#ifdef LIBNVAFX_ENABLED
-	if (ng->handle[0])
+#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