BlueGit

ict rusty-teams

Files

rusty-teams / vendor / webrtc-sys / src / noise_hook.cpp

noise_hook.cpp

noise_hook.cpp 965 B Download Raw
1#include "livekit/noise_hook.h"
2
3#include <string>
4
5#include "modules/audio_processing/audio_buffer.h"
6#include "rust/cxx.h"
7#include "webrtc-sys/src/noise_hook.rs.h"
8
9namespace livekit_ffi {
10
11namespace {
12
13class CapturePostProcessor : public webrtc::CustomProcessing {
14 public:
15 void Initialize(int sample_rate_hz, int num_channels) override {}
16
17 void Process(webrtc::AudioBuffer* audio) override {
18 for (size_t channel = 0; channel < audio->num_channels(); ++channel) {
19 capture_post_process(
20 channel,
21 rust::Slice<float>(audio->channels()[channel], audio->num_frames()));
22 }
23 }
24
25 std::string ToString() const override { return "livekit_capture_post_processor"; }
26
27 void SetRuntimeSetting(webrtc::AudioProcessing::RuntimeSetting setting) override {}
28};
29
30} // namespace
31
32std::unique_ptr<webrtc::CustomProcessing> create_capture_post_processor() {
33 return std::make_unique<CapturePostProcessor>();
34}
35
36} // namespace livekit_ffi