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 <memory> 15 #include <utility> 16 17 #include "modules/audio_processing/include/aec_dump.h" 18 #include "rtc_base/ignore_wundef.h" 19 20 // Files generated at build-time by the protobuf compiler. 21 RTC_PUSH_IGNORING_WUNDEF() 22 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 23 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h" 24 #else 25 #include "modules/audio_processing/debug.pb.h" 26 #endif RTC_POP_IGNORING_WUNDEF()27RTC_POP_IGNORING_WUNDEF() 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 AddOutput(const AudioFrameView<const float>& src); 40 41 void AddInput(const int16_t* const data, 42 int num_channels, 43 int samples_per_channel); 44 void AddOutput(const int16_t* const data, 45 int num_channels, 46 int samples_per_channel); 47 48 void AddAudioProcessingState(const AecDump::AudioProcessingState& state); 49 50 std::unique_ptr<audioproc::Event> FetchEvent() { 51 std::unique_ptr<audioproc::Event> result = std::move(event_); 52 CreateNewEvent(); 53 return result; 54 } 55 56 private: 57 void CreateNewEvent() { 58 event_ = std::make_unique<audioproc::Event>(); 59 event_->set_type(audioproc::Event::STREAM); 60 } 61 std::unique_ptr<audioproc::Event> event_; 62 }; 63 64 } // namespace webrtc 65 66 #endif // MODULES_AUDIO_PROCESSING_AEC_DUMP_CAPTURE_STREAM_INFO_H_ 67