BlueGit

ict rusty-teams

Files

rusty-teams / vendor / webrtc-sys / src / audio_resampler.rs

audio_resampler.rs

audio_resampler.rs 1.3 KiB Download Raw
1// Copyright 2025 LiveKit, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use crate::impl_thread_safety;
16
17#[cxx::bridge(namespace = "livekit_ffi")]
18pub mod ffi {
19 unsafe extern "C++" {
20 include!("livekit/audio_resampler.h");
21
22 type AudioResampler;
23
24 unsafe fn remix_and_resample(
25 self: Pin<&mut AudioResampler>,
26 src: *const i16,
27 samples_per_channel: usize,
28 num_channels: usize,
29 sample_rate: i32,
30 dst_num_channels: usize,
31 dst_sample_rate: i32,
32 ) -> usize;
33
34 unsafe fn data(self: &AudioResampler) -> *const i16;
35
36 fn create_audio_resampler() -> UniquePtr<AudioResampler>;
37 }
38}
39
40impl_thread_safety!(ffi::AudioResampler, Send + Sync);