remix_resample.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #ifndef AUDIO_REMIX_RESAMPLE_H_
  11. #define AUDIO_REMIX_RESAMPLE_H_
  12. #include "api/audio/audio_frame.h"
  13. #include "common_audio/resampler/include/push_resampler.h"
  14. namespace webrtc {
  15. namespace voe {
  16. // Upmix or downmix and resample the audio to |dst_frame|. Expects |dst_frame|
  17. // to have its sample rate and channels members set to the desired values.
  18. // Updates the |samples_per_channel_| member accordingly.
  19. //
  20. // This version has an AudioFrame |src_frame| as input and sets the output
  21. // |timestamp_|, |elapsed_time_ms_| and |ntp_time_ms_| members equals to the
  22. // input ones.
  23. void RemixAndResample(const AudioFrame& src_frame,
  24. PushResampler<int16_t>* resampler,
  25. AudioFrame* dst_frame);
  26. // This version has a pointer to the samples |src_data| as input and receives
  27. // |samples_per_channel|, |num_channels| and |sample_rate_hz| of the data as
  28. // parameters.
  29. void RemixAndResample(const int16_t* src_data,
  30. size_t samples_per_channel,
  31. size_t num_channels,
  32. int sample_rate_hz,
  33. PushResampler<int16_t>* resampler,
  34. AudioFrame* dst_frame);
  35. } // namespace voe
  36. } // namespace webrtc
  37. #endif // AUDIO_REMIX_RESAMPLE_H_