diff options
| author | Marvin W <git@larma.de> | 2025-02-24 21:19:31 +0100 |
|---|---|---|
| committer | Marvin W <git@larma.de> | 2025-02-24 21:26:04 +0100 |
| commit | e2872d8bcc82122e3dd32211bb08d02ab984b691 (patch) | |
| tree | f2696c2cc1cdfbe65366e293e9db554c0e6558c7 | |
| parent | 76261a2ac5cd2469126060531442a299f919cede (diff) | |
Voice processor: merge init and setup methods
This ensures we are never in an uninitialized state when processing audio data
| -rw-r--r-- | plugins/rtp/src/voice_processor.vala | 2 | ||||
| -rw-r--r-- | plugins/rtp/src/voice_processor_native.cpp | 11 |
2 files changed, 3 insertions, 10 deletions
diff --git a/plugins/rtp/src/voice_processor.vala b/plugins/rtp/src/voice_processor.vala index a522a6ce..064684c5 100644 --- a/plugins/rtp/src/voice_processor.vala +++ b/plugins/rtp/src/voice_processor.vala @@ -99,7 +99,6 @@ public class Dino.Plugins.Rtp.VoiceProcessor : Audio.Filter { } private static extern void* init_native(int stream_delay); - private static extern void setup_native(void* native); private static extern void destroy_native(void* native); private static extern void analyze_reverse_stream(void* native, Audio.Info info, Buffer buffer); private static extern void process_stream(void* native, Audio.Info info, Buffer buffer); @@ -115,7 +114,6 @@ public class Dino.Plugins.Rtp.VoiceProcessor : Audio.Filter { period_samples = info.rate / 100; // 10ms buffers period_size = period_samples * info.bpf; adapter.clear(); - setup_native(native); return true; } diff --git a/plugins/rtp/src/voice_processor_native.cpp b/plugins/rtp/src/voice_processor_native.cpp index 39fbf1dc..7440765d 100644 --- a/plugins/rtp/src/voice_processor_native.cpp +++ b/plugins/rtp/src/voice_processor_native.cpp @@ -33,19 +33,13 @@ extern "C" void *dino_plugins_rtp_adjust_to_running_time(GstBaseTransform *trans extern "C" void *dino_plugins_rtp_voice_processor_init_native(gint stream_delay) { auto *native = new _DinoPluginsRtpVoiceProcessorNative(); -#ifdef WEBRTC0 + native->stream_delay = stream_delay; +#if defined(WEBRTC0) webrtc::Config config; config.Set<webrtc::ExtendedFilter>(new webrtc::ExtendedFilter(true)); config.Set<webrtc::ExperimentalAgc>(new webrtc::ExperimentalAgc(true, 85)); native->apm = webrtc::AudioProcessing::Create(config); -#endif - native->stream_delay = stream_delay; - return native; -} -extern "C" void dino_plugins_rtp_voice_processor_setup_native(void *native_ptr) { - auto *native = (_DinoPluginsRtpVoiceProcessorNative *) native_ptr; -#if defined(WEBRTC0) webrtc::AudioProcessing *apm = native->apm; webrtc::ProcessingConfig pconfig; pconfig.streams[webrtc::ProcessingConfig::kInputStream] = @@ -90,6 +84,7 @@ extern "C" void dino_plugins_rtp_voice_processor_setup_native(void *native_ptr) #endif apm->ApplyConfig(config); #endif + return native; } extern "C" void |
