BlueGit

ict rusty-teams

Files

rusty-teams / vendor / webrtc-sys / include / livekit / audio_resampler.h

audio_resampler.h

audio_resampler.h 1.4 KiB Download Raw
1/*
2 * Copyright 2025 LiveKit, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <memory>
20
21#include "api/audio/audio_frame.h"
22#include "api/data_channel_interface.h"
23#include "common_audio/resampler/include/push_resampler.h"
24#include "livekit/webrtc.h"
25#include "rust/cxx.h"
26
27namespace livekit_ffi {
28
29class AudioResampler {
30 public:
31 size_t remix_and_resample(const int16_t* src,
32 size_t samples_per_channel,
33 size_t num_channels,
34 int sample_rate_hz,
35 size_t dest_num_channels,
36 int dest_sample_rate_hz);
37
38 const int16_t* data() const;
39
40 private:
41 webrtc::AudioFrame frame_;
42 webrtc::PushResampler<int16_t> resampler_;
43};
44
45std::unique_ptr<AudioResampler> create_audio_resampler();
46
47} // namespace livekit_ffi