blob: d2f34686dd2870fb5ad3a92c86c1a1c74b730cd1 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:251/*
braveyao@webrtc.orgd7131432012-03-29 10:39:442 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:253 *
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 10:18:3111#ifndef AUDIO_REMIX_RESAMPLE_H_
12#define AUDIO_REMIX_RESAMPLE_H_
niklase@google.com470e71d2011-07-07 08:21:2513
Fredrik Solenbergbbf21a32018-04-12 20:44:0914#include "api/audio/audio_frame.h"
Tommi32c33982024-07-03 07:34:1815#include "api/audio/audio_view.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3116#include "common_audio/resampler/include/push_resampler.h"
niklase@google.com470e71d2011-07-07 08:21:2517
andrew@webrtc.org40ee3d02014-04-03 21:56:0118namespace webrtc {
andrew@webrtc.org40ee3d02014-04-03 21:56:0119namespace voe {
niklase@google.com470e71d2011-07-07 08:21:2520
Tommi1f367982024-04-30 12:04:4421// Note: The RemixAndResample methods assume 10ms buffer sizes.
22
Artem Titovb0ea6372021-07-26 09:47:0723// Upmix or downmix and resample the audio to `dst_frame`. Expects `dst_frame`
Alejandro Luebscdfe20b2015-09-23 19:49:1224// to have its sample rate and channels members set to the desired values.
Artem Titovb0ea6372021-07-26 09:47:0725// Updates the `samples_per_channel_` member accordingly.
Alejandro Luebscdfe20b2015-09-23 19:49:1226//
Artem Titovb0ea6372021-07-26 09:47:0727// This version has an AudioFrame `src_frame` as input and sets the output
28// `timestamp_`, `elapsed_time_ms_` and `ntp_time_ms_` members equals to the
Alejandro Luebscdfe20b2015-09-23 19:49:1229// input ones.
andrew@webrtc.org40ee3d02014-04-03 21:56:0130void RemixAndResample(const AudioFrame& src_frame,
andrew@webrtc.orgf5a33f12014-04-19 00:32:0731 PushResampler<int16_t>* resampler,
andrew@webrtc.org40ee3d02014-04-03 21:56:0132 AudioFrame* dst_frame);
niklase@google.com470e71d2011-07-07 08:21:2533
Tommi32c33982024-07-03 07:34:1834// TODO(tommi): The `sample_rate_hz` argument can probably be removed since it's
35// always related to `src_data.samples_per_frame()'.
36void RemixAndResample(InterleavedView<const int16_t> src_data,
Alejandro Luebscdfe20b2015-09-23 19:49:1237 int sample_rate_hz,
38 PushResampler<int16_t>* resampler,
39 AudioFrame* dst_frame);
niklase@google.com470e71d2011-07-07 08:21:2540
pbos@webrtc.orgd900e8b2013-07-03 15:12:2641} // namespace voe
pbos@webrtc.orgd900e8b2013-07-03 15:12:2642} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:2543
Fredrik Solenberga8b7c7f2018-01-17 10:18:3144#endif // AUDIO_REMIX_RESAMPLE_H_