OLD | NEW |
(Empty) | |
| 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 WEBRTC_MODULES_AUDIO_PROCESSING_AEC_DUMP_AEC_DUMP_IMPL_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_DUMP_AEC_DUMP_IMPL_H_ |
| 13 |
| 14 #include <memory> |
| 15 #include <string> |
| 16 #include <vector> |
| 17 |
| 18 #include "webrtc/base/ignore_wundef.h" |
| 19 #include "webrtc/base/platform_file.h" |
| 20 #include "webrtc/base/protobuf_utils.h" |
| 21 #include "webrtc/base/race_checker.h" |
| 22 #include "webrtc/base/task_queue.h" |
| 23 #include "webrtc/base/thread_annotations.h" |
| 24 #include "webrtc/modules/audio_processing/aec_dump/capture_stream_info.h" |
| 25 #include "webrtc/modules/audio_processing/aec_dump/write_to_file_task.h" |
| 26 #include "webrtc/modules/audio_processing/include/aec_dump.h" |
| 27 #include "webrtc/modules/include/module_common_types.h" |
| 28 #include "webrtc/system_wrappers/include/file_wrapper.h" |
| 29 |
| 30 // Files generated at build-time by the protobuf compiler. |
| 31 RTC_PUSH_IGNORING_WUNDEF() |
| 32 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
| 33 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h" |
| 34 #else |
| 35 #include "webrtc/modules/audio_processing/debug.pb.h" |
| 36 #endif |
| 37 RTC_POP_IGNORING_WUNDEF() |
| 38 |
| 39 namespace rtc { |
| 40 class TaskQueue; |
| 41 } // namespace rtc |
| 42 |
| 43 namespace webrtc { |
| 44 |
| 45 // Task-queue based implementation of AecDump. It is thread safe by |
| 46 // relying on locks in TaskQueue. |
| 47 class AecDumpImpl : public AecDump { |
| 48 public: |
| 49 // Does member variables initialization shared across all c-tors. |
| 50 AecDumpImpl(std::unique_ptr<FileWrapper> debug_file, |
| 51 int64_t max_log_size_bytes, |
| 52 rtc::TaskQueue* worker_queue); |
| 53 |
| 54 ~AecDumpImpl() override; |
| 55 |
| 56 void AddCaptureStreamInput(const FloatAudioFrame& src) override; |
| 57 void AddCaptureStreamOutput(const FloatAudioFrame& src) override; |
| 58 |
| 59 void AddCaptureStreamInput(const AudioFrame& frame) override; |
| 60 void AddCaptureStreamOutput(const AudioFrame& frame) override; |
| 61 void AddAudioProcessingState(const AudioProcessingState& state) override; |
| 62 |
| 63 void WriteInitMessage(const InternalAPMStreamsConfig& api_format) override; |
| 64 void WriteRenderStreamMessage(const AudioFrame& frame) override; |
| 65 void WriteRenderStreamMessage(const FloatAudioFrame& src) override; |
| 66 void WriteCaptureStreamMessage() override; |
| 67 void WriteConfig(const InternalAPMConfig& config, bool forced) override; |
| 68 |
| 69 private: |
| 70 std::unique_ptr<WriteToFileTask> CreateWriteToFileTask(); |
| 71 |
| 72 // Implementation detail of WriteConfig: If not |forced|, only |
| 73 // writes the current config if it is different from the last saved |
| 74 // one; if |forced|, writes the config regardless of the last saved. |
| 75 ProtoString last_serialized_capture_config_ GUARDED_BY(race_checker_) = ""; |
| 76 std::unique_ptr<FileWrapper> debug_file_; |
| 77 int64_t num_bytes_left_for_log_ = 0; |
| 78 rtc::RaceChecker race_checker_; |
| 79 rtc::TaskQueue* worker_queue_; |
| 80 CaptureStreamInfo capture_stream_info_; |
| 81 }; |
| 82 } // namespace webrtc |
| 83 |
| 84 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_DUMP_AEC_DUMP_IMPL_H_ |
OLD | NEW |