tor-browser

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

capture_stream_info.h (2227B)


      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_PROCESSING_AEC_DUMP_CAPTURE_STREAM_INFO_H_
     12 #define MODULES_AUDIO_PROCESSING_AEC_DUMP_CAPTURE_STREAM_INFO_H_
     13 
     14 #include <cstdint>
     15 #include <memory>
     16 #include <utility>
     17 
     18 #include "api/audio/audio_view.h"
     19 #include "modules/audio_processing/include/aec_dump.h"
     20 #include "modules/audio_processing/include/audio_frame_view.h"
     21 
     22 // Files generated at build-time by the protobuf compiler.
     23 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
     24 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h"
     25 #else
     26 #include "modules/audio_processing/debug.pb.h"
     27 #endif
     28 
     29 namespace webrtc {
     30 
     31 class CaptureStreamInfo {
     32 public:
     33  CaptureStreamInfo() { CreateNewEvent(); }
     34  CaptureStreamInfo(const CaptureStreamInfo&) = delete;
     35  CaptureStreamInfo& operator=(const CaptureStreamInfo&) = delete;
     36  ~CaptureStreamInfo() = default;
     37 
     38  void AddInput(const AudioFrameView<const float>& src);
     39  void AddInputChannel(MonoView<const float> channel);
     40  void AddOutput(const AudioFrameView<const float>& src);
     41  void AddOutputChannel(MonoView<const float> channel);
     42 
     43  void AddInput(const int16_t* const data,
     44                int num_channels,
     45                int samples_per_channel);
     46  void AddOutput(const int16_t* const data,
     47                 int num_channels,
     48                 int samples_per_channel);
     49 
     50  void AddAudioProcessingState(const AecDump::AudioProcessingState& state);
     51 
     52  std::unique_ptr<audioproc::Event> FetchEvent() {
     53    std::unique_ptr<audioproc::Event> result = std::move(event_);
     54    CreateNewEvent();
     55    return result;
     56  }
     57 
     58 private:
     59  void CreateNewEvent() {
     60    event_ = std::make_unique<audioproc::Event>();
     61    event_->set_type(audioproc::Event::STREAM);
     62  }
     63  std::unique_ptr<audioproc::Event> event_;
     64 };
     65 
     66 }  // namespace webrtc
     67 
     68 #endif  // MODULES_AUDIO_PROCESSING_AEC_DUMP_CAPTURE_STREAM_INFO_H_