remix_resample.h (1688B)
1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef AUDIO_REMIX_RESAMPLE_H_ 12 #define AUDIO_REMIX_RESAMPLE_H_ 13 14 #include <cstdint> 15 16 #include "api/audio/audio_frame.h" 17 #include "api/audio/audio_view.h" 18 #include "common_audio/resampler/include/push_resampler.h" 19 20 namespace webrtc { 21 namespace voe { 22 23 // Note: The RemixAndResample methods assume 10ms buffer sizes. 24 25 // Upmix or downmix and resample the audio to `dst_frame`. Expects `dst_frame` 26 // to have its sample rate and channels members set to the desired values. 27 // Updates the `samples_per_channel_` member accordingly. 28 // 29 // This version has an AudioFrame `src_frame` as input and sets the output 30 // `timestamp_`, `elapsed_time_ms_` and `ntp_time_ms_` members equals to the 31 // input ones. 32 void RemixAndResample(const AudioFrame& src_frame, 33 PushResampler<int16_t>* resampler, 34 AudioFrame* dst_frame); 35 36 // TODO(tommi): The `sample_rate_hz` argument can probably be removed since it's 37 // always related to `src_data.samples_per_frame()'. 38 void RemixAndResample(InterleavedView<const int16_t> src_data, 39 int sample_rate_hz, 40 PushResampler<int16_t>* resampler, 41 AudioFrame* dst_frame); 42 43 } // namespace voe 44 } // namespace webrtc 45 46 #endif // AUDIO_REMIX_RESAMPLE_H_