tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

frame_combiner.h (1799B)


      1 /*
      2 *  Copyright (c) 2017 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 MODULES_AUDIO_MIXER_FRAME_COMBINER_H_
     12 #define MODULES_AUDIO_MIXER_FRAME_COMBINER_H_
     13 
     14 #include <array>
     15 #include <cstddef>
     16 #include <memory>
     17 
     18 #include "api/array_view.h"
     19 #include "api/audio/audio_frame.h"
     20 #include "modules/audio_processing/agc2/limiter.h"
     21 
     22 namespace webrtc {
     23 class ApmDataDumper;
     24 
     25 class FrameCombiner {
     26 public:
     27  explicit FrameCombiner(bool use_limiter);
     28  ~FrameCombiner();
     29 
     30  // Combine several frames into one. Assumes sample_rate,
     31  // samples_per_channel of the input frames match the parameters. The
     32  // parameters 'number_of_channels' and 'sample_rate' are needed
     33  // because 'mix_list' can be empty. The parameter
     34  // 'number_of_streams' is used for determining whether to pass the
     35  // data through a limiter.
     36  void Combine(ArrayView<AudioFrame* const> mix_list,
     37               size_t number_of_channels,
     38               int sample_rate,
     39               size_t number_of_streams,
     40               AudioFrame* audio_frame_for_mixing);
     41 
     42  // Stereo, 48 kHz, 10 ms.
     43  static constexpr size_t kMaximumNumberOfChannels = 8;
     44  static constexpr size_t kMaximumChannelSize = 48 * 10;
     45 
     46 private:
     47  std::unique_ptr<ApmDataDumper> data_dumper_;
     48  Limiter limiter_;
     49  const bool use_limiter_;
     50  std::array<float, kMaximumChannelSize * kMaximumNumberOfChannels>
     51      mixing_buffer_ = {};
     52 };
     53 }  // namespace webrtc
     54 
     55 #endif  // MODULES_AUDIO_MIXER_FRAME_COMBINER_H_