OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_FILE_PROCESSOR_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_FILE_PROCESSOR_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_FILE_PROCESSOR_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_FILE_PROCESSOR_H_ |
13 | 13 |
14 #include <algorithm> | 14 #include <algorithm> |
15 #include <limits> | 15 #include <limits> |
| 16 #include <memory> |
16 #include <vector> | 17 #include <vector> |
17 | 18 |
18 #include "webrtc/base/scoped_ptr.h" | |
19 #include "webrtc/common_audio/channel_buffer.h" | 19 #include "webrtc/common_audio/channel_buffer.h" |
20 #include "webrtc/common_audio/wav_file.h" | 20 #include "webrtc/common_audio/wav_file.h" |
21 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 21 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
22 #include "webrtc/modules/audio_processing/test/test_utils.h" | 22 #include "webrtc/modules/audio_processing/test/test_utils.h" |
23 #include "webrtc/system_wrappers/include/tick_util.h" | 23 #include "webrtc/system_wrappers/include/tick_util.h" |
24 | 24 |
25 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | 25 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
26 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h" | 26 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h" |
27 #else | 27 #else |
28 #include "webrtc/modules/audio_processing/debug.pb.h" | 28 #include "webrtc/modules/audio_processing/debug.pb.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 TickIntervalStats* mutable_proc_time() { return &proc_time_; } | 77 TickIntervalStats* mutable_proc_time() { return &proc_time_; } |
78 | 78 |
79 private: | 79 private: |
80 TickIntervalStats proc_time_; | 80 TickIntervalStats proc_time_; |
81 }; | 81 }; |
82 | 82 |
83 // Used to read from and write to WavFile objects. | 83 // Used to read from and write to WavFile objects. |
84 class WavFileProcessor final : public AudioFileProcessor { | 84 class WavFileProcessor final : public AudioFileProcessor { |
85 public: | 85 public: |
86 // Takes ownership of all parameters. | 86 // Takes ownership of all parameters. |
87 WavFileProcessor(rtc::scoped_ptr<AudioProcessing> ap, | 87 WavFileProcessor(std::unique_ptr<AudioProcessing> ap, |
88 rtc::scoped_ptr<WavReader> in_file, | 88 std::unique_ptr<WavReader> in_file, |
89 rtc::scoped_ptr<WavWriter> out_file); | 89 std::unique_ptr<WavWriter> out_file); |
90 virtual ~WavFileProcessor() {} | 90 virtual ~WavFileProcessor() {} |
91 | 91 |
92 // Processes one chunk from the WAV input and writes to the WAV output. | 92 // Processes one chunk from the WAV input and writes to the WAV output. |
93 bool ProcessChunk() override; | 93 bool ProcessChunk() override; |
94 | 94 |
95 private: | 95 private: |
96 rtc::scoped_ptr<AudioProcessing> ap_; | 96 std::unique_ptr<AudioProcessing> ap_; |
97 | 97 |
98 ChannelBuffer<float> in_buf_; | 98 ChannelBuffer<float> in_buf_; |
99 ChannelBuffer<float> out_buf_; | 99 ChannelBuffer<float> out_buf_; |
100 const StreamConfig input_config_; | 100 const StreamConfig input_config_; |
101 const StreamConfig output_config_; | 101 const StreamConfig output_config_; |
102 ChannelBufferWavReader buffer_reader_; | 102 ChannelBufferWavReader buffer_reader_; |
103 ChannelBufferWavWriter buffer_writer_; | 103 ChannelBufferWavWriter buffer_writer_; |
104 }; | 104 }; |
105 | 105 |
106 // Used to read from an aecdump file and write to a WavWriter. | 106 // Used to read from an aecdump file and write to a WavWriter. |
107 class AecDumpFileProcessor final : public AudioFileProcessor { | 107 class AecDumpFileProcessor final : public AudioFileProcessor { |
108 public: | 108 public: |
109 // Takes ownership of all parameters. | 109 // Takes ownership of all parameters. |
110 AecDumpFileProcessor(rtc::scoped_ptr<AudioProcessing> ap, | 110 AecDumpFileProcessor(std::unique_ptr<AudioProcessing> ap, |
111 FILE* dump_file, | 111 FILE* dump_file, |
112 rtc::scoped_ptr<WavWriter> out_file); | 112 std::unique_ptr<WavWriter> out_file); |
113 | 113 |
114 virtual ~AecDumpFileProcessor(); | 114 virtual ~AecDumpFileProcessor(); |
115 | 115 |
116 // Processes messages from the aecdump file until the first Stream message is | 116 // Processes messages from the aecdump file until the first Stream message is |
117 // completed. Passes other data from the aecdump messages as appropriate. | 117 // completed. Passes other data from the aecdump messages as appropriate. |
118 bool ProcessChunk() override; | 118 bool ProcessChunk() override; |
119 | 119 |
120 private: | 120 private: |
121 void HandleMessage(const webrtc::audioproc::Init& msg); | 121 void HandleMessage(const webrtc::audioproc::Init& msg); |
122 void HandleMessage(const webrtc::audioproc::Stream& msg); | 122 void HandleMessage(const webrtc::audioproc::Stream& msg); |
123 void HandleMessage(const webrtc::audioproc::ReverseStream& msg); | 123 void HandleMessage(const webrtc::audioproc::ReverseStream& msg); |
124 | 124 |
125 rtc::scoped_ptr<AudioProcessing> ap_; | 125 std::unique_ptr<AudioProcessing> ap_; |
126 FILE* dump_file_; | 126 FILE* dump_file_; |
127 | 127 |
128 rtc::scoped_ptr<ChannelBuffer<float>> in_buf_; | 128 std::unique_ptr<ChannelBuffer<float>> in_buf_; |
129 rtc::scoped_ptr<ChannelBuffer<float>> reverse_buf_; | 129 std::unique_ptr<ChannelBuffer<float>> reverse_buf_; |
130 ChannelBuffer<float> out_buf_; | 130 ChannelBuffer<float> out_buf_; |
131 StreamConfig input_config_; | 131 StreamConfig input_config_; |
132 StreamConfig reverse_config_; | 132 StreamConfig reverse_config_; |
133 const StreamConfig output_config_; | 133 const StreamConfig output_config_; |
134 ChannelBufferWavWriter buffer_writer_; | 134 ChannelBufferWavWriter buffer_writer_; |
135 }; | 135 }; |
136 | 136 |
137 } // namespace webrtc | 137 } // namespace webrtc |
138 | 138 |
139 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_FILE_PROCESSOR_H_ | 139 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_FILE_PROCESSOR_H_ |
OLD | NEW |