OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 int Initialize() override; | 50 int Initialize() override; |
51 int Initialize(int input_sample_rate_hz, | 51 int Initialize(int input_sample_rate_hz, |
52 int output_sample_rate_hz, | 52 int output_sample_rate_hz, |
53 int reverse_sample_rate_hz, | 53 int reverse_sample_rate_hz, |
54 ChannelLayout input_layout, | 54 ChannelLayout input_layout, |
55 ChannelLayout output_layout, | 55 ChannelLayout output_layout, |
56 ChannelLayout reverse_layout) override; | 56 ChannelLayout reverse_layout) override; |
57 int Initialize(const ProcessingConfig& processing_config) override; | 57 int Initialize(const ProcessingConfig& processing_config) override; |
58 void SetExtraOptions(const Config& config) override; | 58 void SetExtraOptions(const Config& config) override; |
59 void UpdateHistogramsOnCallEnd() override; | 59 void UpdateHistogramsOnCallEnd() override; |
60 int StartDebugRecording(const char filename[kMaxFilenameSize], | 60 int StartDebugRecording(const char filename[kMaxFilenameSize]) override; |
61 int64_t max_log_size_bytes) override; | 61 int StartDebugRecording(FILE* handle) override; |
62 int StartDebugRecording(FILE* handle, int64_t max_log_size_bytes) override; | |
63 int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) override; | 62 int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) override; |
64 int StopDebugRecording() override; | 63 int StopDebugRecording() override; |
65 | 64 |
66 // Capture-side exclusive methods possibly running APM in a | 65 // Capture-side exclusive methods possibly running APM in a |
67 // multi-threaded manner. Acquire the capture lock. | 66 // multi-threaded manner. Acquire the capture lock. |
68 int ProcessStream(AudioFrame* frame) override; | 67 int ProcessStream(AudioFrame* frame) override; |
69 int ProcessStream(const float* const* src, | 68 int ProcessStream(const float* const* src, |
70 size_t samples_per_channel, | 69 size_t samples_per_channel, |
71 int input_sample_rate_hz, | 70 int input_sample_rate_hz, |
72 ChannelLayout input_layout, | 71 ChannelLayout input_layout, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} | 135 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} |
137 rtc::scoped_ptr<audioproc::Event> event_msg; // Protobuf message. | 136 rtc::scoped_ptr<audioproc::Event> event_msg; // Protobuf message. |
138 std::string event_str; // Memory for protobuf serialization. | 137 std::string event_str; // Memory for protobuf serialization. |
139 | 138 |
140 // Serialized string of last saved APM configuration. | 139 // Serialized string of last saved APM configuration. |
141 std::string last_serialized_config; | 140 std::string last_serialized_config; |
142 }; | 141 }; |
143 | 142 |
144 struct ApmDebugDumpState { | 143 struct ApmDebugDumpState { |
145 ApmDebugDumpState() : debug_file(FileWrapper::Create()) {} | 144 ApmDebugDumpState() : debug_file(FileWrapper::Create()) {} |
146 // Number of bytes that can still be written to the log before the maximum | |
147 // size is reached. A value of <= 0 indicates that no limit is used. | |
148 int64_t num_bytes_left_for_log_ = -1; | |
149 rtc::scoped_ptr<FileWrapper> debug_file; | 145 rtc::scoped_ptr<FileWrapper> debug_file; |
150 ApmDebugDumpThreadState render; | 146 ApmDebugDumpThreadState render; |
151 ApmDebugDumpThreadState capture; | 147 ApmDebugDumpThreadState capture; |
152 }; | 148 }; |
153 #endif | 149 #endif |
154 | 150 |
155 // Method for modifying the formats struct that are called from both | 151 // Method for modifying the formats struct that are called from both |
156 // the render and capture threads. The check for whether modifications | 152 // the render and capture threads. The check for whether modifications |
157 // are needed is done while holding the render lock only, thereby avoiding | 153 // are needed is done while holding the render lock only, thereby avoiding |
158 // that the capture thread blocks the render thread. | 154 // that the capture thread blocks the render thread. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 209 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
214 bool is_rev_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 210 bool is_rev_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
215 int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 211 int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
216 | 212 |
217 // Debug dump methods that are internal and called without locks. | 213 // Debug dump methods that are internal and called without locks. |
218 // TODO(peah): Make thread safe. | 214 // TODO(peah): Make thread safe. |
219 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 215 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
220 // TODO(andrew): make this more graceful. Ideally we would split this stuff | 216 // TODO(andrew): make this more graceful. Ideally we would split this stuff |
221 // out into a separate class with an "enabled" and "disabled" implementation. | 217 // out into a separate class with an "enabled" and "disabled" implementation. |
222 static int WriteMessageToDebugFile(FileWrapper* debug_file, | 218 static int WriteMessageToDebugFile(FileWrapper* debug_file, |
223 int64_t* filesize_limit_bytes, | |
224 rtc::CriticalSection* crit_debug, | 219 rtc::CriticalSection* crit_debug, |
225 ApmDebugDumpThreadState* debug_state); | 220 ApmDebugDumpThreadState* debug_state); |
226 int WriteInitMessage() EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); | 221 int WriteInitMessage() EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
227 | 222 |
228 // Writes Config message. If not |forced|, only writes the current config if | 223 // Writes Config message. If not |forced|, only writes the current config if |
229 // it is different from the last saved one; if |forced|, writes the config | 224 // it is different from the last saved one; if |forced|, writes the config |
230 // regardless of the last saved. | 225 // regardless of the last saved. |
231 int WriteConfigMessage(bool forced) EXCLUSIVE_LOCKS_REQUIRED(crit_capture_) | 226 int WriteConfigMessage(bool forced) EXCLUSIVE_LOCKS_REQUIRED(crit_capture_) |
232 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); | 227 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
233 | 228 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 327 |
333 struct ApmRenderState { | 328 struct ApmRenderState { |
334 rtc::scoped_ptr<AudioConverter> render_converter; | 329 rtc::scoped_ptr<AudioConverter> render_converter; |
335 rtc::scoped_ptr<AudioBuffer> render_audio; | 330 rtc::scoped_ptr<AudioBuffer> render_audio; |
336 } render_ GUARDED_BY(crit_render_); | 331 } render_ GUARDED_BY(crit_render_); |
337 }; | 332 }; |
338 | 333 |
339 } // namespace webrtc | 334 } // namespace webrtc |
340 | 335 |
341 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 336 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
OLD | NEW |