OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 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_TEST_DEBUG_DUMP_REPLAYER_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_DEBUG_DUMP_REPLAYER_H_ |
| 13 |
| 14 #include <memory> |
| 15 #include <string> |
| 16 |
| 17 #include "webrtc/common_audio/channel_buffer.h" |
| 18 #include "webrtc/modules/audio_processing/debug.pb.h" |
| 19 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 20 |
| 21 namespace webrtc { |
| 22 namespace test { |
| 23 |
| 24 class DebugDumpReplayer { |
| 25 public: |
| 26 DebugDumpReplayer(); |
| 27 ~DebugDumpReplayer(); |
| 28 |
| 29 // Set dump file |
| 30 bool SetDumpFile(const std::string& filename); |
| 31 |
| 32 // Return next event. |
| 33 rtc::Optional<audioproc::Event> GetNextEvent() const; |
| 34 |
| 35 // Run the next event. Returns true if succeeded. |
| 36 bool RunNextEvent(); |
| 37 |
| 38 const ChannelBuffer<float>* GetOutput() const; |
| 39 StreamConfig GetOutputConfig() const; |
| 40 |
| 41 private: |
| 42 // Following functions are facilities for replaying debug dumps. |
| 43 void OnInitEvent(const audioproc::Init& msg); |
| 44 void OnStreamEvent(const audioproc::Stream& msg); |
| 45 void OnReverseStreamEvent(const audioproc::ReverseStream& msg); |
| 46 void OnConfigEvent(const audioproc::Config& msg); |
| 47 |
| 48 void MaybeRecreateApm(const audioproc::Config& msg); |
| 49 void ConfigureApm(const audioproc::Config& msg); |
| 50 |
| 51 void LoadNextMessage(); |
| 52 |
| 53 // Buffer for APM input/output. |
| 54 std::unique_ptr<ChannelBuffer<float>> input_; |
| 55 std::unique_ptr<ChannelBuffer<float>> reverse_; |
| 56 std::unique_ptr<ChannelBuffer<float>> output_; |
| 57 |
| 58 std::unique_ptr<AudioProcessing> apm_; |
| 59 |
| 60 FILE* debug_file_; |
| 61 |
| 62 StreamConfig input_config_; |
| 63 StreamConfig reverse_config_; |
| 64 StreamConfig output_config_; |
| 65 |
| 66 bool has_next_event_; |
| 67 audioproc::Event next_event_; |
| 68 }; |
| 69 |
| 70 } // namespace test |
| 71 } // namespace webrtc |
| 72 |
| 73 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_DEBUG_DUMP_REPLAYER_H_ |
OLD | NEW |