blob: bd8da76c6a1e008d348679a9b8e8b546feaa6d46 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
braveyao@webrtc.orgd7131432012-03-29 10:39:44 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
Fredrik Solenberga8b7c7f2018-01-17 11:18:31 +010011#ifndef AUDIO_REMIX_RESAMPLE_H_
12#define AUDIO_REMIX_RESAMPLE_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Fredrik Solenbergbbf21a32018-04-12 22:44:09 +020014#include "api/audio/audio_frame.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020015#include "common_audio/resampler/include/push_resampler.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000016
andrew@webrtc.org40ee3d02014-04-03 21:56:01 +000017namespace webrtc {
andrew@webrtc.org40ee3d02014-04-03 21:56:01 +000018namespace voe {
niklase@google.com470e71d2011-07-07 08:21:25 +000019
Artem Titovb0ea6372021-07-26 11:47:07 +020020// Upmix or downmix and resample the audio to `dst_frame`. Expects `dst_frame`
Alejandro Luebscdfe20b2015-09-23 12:49:12 -070021// to have its sample rate and channels members set to the desired values.
Artem Titovb0ea6372021-07-26 11:47:07 +020022// Updates the `samples_per_channel_` member accordingly.
Alejandro Luebscdfe20b2015-09-23 12:49:12 -070023//
Artem Titovb0ea6372021-07-26 11:47:07 +020024// This version has an AudioFrame `src_frame` as input and sets the output
25// `timestamp_`, `elapsed_time_ms_` and `ntp_time_ms_` members equals to the
Alejandro Luebscdfe20b2015-09-23 12:49:12 -070026// input ones.
andrew@webrtc.org40ee3d02014-04-03 21:56:01 +000027void RemixAndResample(const AudioFrame& src_frame,
andrew@webrtc.orgf5a33f12014-04-19 00:32:07 +000028 PushResampler<int16_t>* resampler,
andrew@webrtc.org40ee3d02014-04-03 21:56:01 +000029 AudioFrame* dst_frame);
niklase@google.com470e71d2011-07-07 08:21:25 +000030
Artem Titovb0ea6372021-07-26 11:47:07 +020031// This version has a pointer to the samples `src_data` as input and receives
32// `samples_per_channel`, `num_channels` and `sample_rate_hz` of the data as
Alejandro Luebscdfe20b2015-09-23 12:49:12 -070033// parameters.
34void RemixAndResample(const int16_t* src_data,
35 size_t samples_per_channel,
Peter Kasting69558702016-01-12 16:26:35 -080036 size_t num_channels,
Alejandro Luebscdfe20b2015-09-23 12:49:12 -070037 int sample_rate_hz,
38 PushResampler<int16_t>* resampler,
39 AudioFrame* dst_frame);
niklase@google.com470e71d2011-07-07 08:21:25 +000040
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000041} // namespace voe
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000042} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000043
Fredrik Solenberga8b7c7f2018-01-17 11:18:31 +010044#endif // AUDIO_REMIX_RESAMPLE_H_