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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} | 136 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} |
138 rtc::scoped_ptr<audioproc::Event> event_msg; // Protobuf message. | 137 rtc::scoped_ptr<audioproc::Event> event_msg; // Protobuf message. |
139 std::string event_str; // Memory for protobuf serialization. | 138 std::string event_str; // Memory for protobuf serialization. |
140 | 139 |
141 // Serialized string of last saved APM configuration. | 140 // Serialized string of last saved APM configuration. |
142 std::string last_serialized_config; | 141 std::string last_serialized_config; |
143 }; | 142 }; |
144 | 143 |
145 struct ApmDebugDumpState { | 144 struct ApmDebugDumpState { |
146 ApmDebugDumpState() : debug_file(FileWrapper::Create()) {} | 145 ApmDebugDumpState() : debug_file(FileWrapper::Create()) {} |
147 // Number of bytes that can still be written to the log before the maximum | |
148 // size is reached. A value of <= 0 indicates that no limit is used. | |
149 int64_t num_bytes_left_for_log_ = -1; | |
150 rtc::scoped_ptr<FileWrapper> debug_file; | 146 rtc::scoped_ptr<FileWrapper> debug_file; |
151 ApmDebugDumpThreadState render; | 147 ApmDebugDumpThreadState render; |
152 ApmDebugDumpThreadState capture; | 148 ApmDebugDumpThreadState capture; |
153 }; | 149 }; |
154 #endif | 150 #endif |
155 | 151 |
156 // Method for modifying the formats struct that are called from both | 152 // Method for modifying the formats struct that are called from both |
157 // the render and capture threads. The check for whether modifications | 153 // the render and capture threads. The check for whether modifications |
158 // are needed is done while holding the render lock only, thereby avoiding | 154 // are needed is done while holding the render lock only, thereby avoiding |
159 // that the capture thread blocks the render thread. | 155 // that the capture thread blocks the render thread. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 214 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
219 bool is_rev_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 215 bool is_rev_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
220 int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 216 int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
221 | 217 |
222 // Debug dump methods that are internal and called without locks. | 218 // Debug dump methods that are internal and called without locks. |
223 // TODO(peah): Make thread safe. | 219 // TODO(peah): Make thread safe. |
224 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 220 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
225 // TODO(andrew): make this more graceful. Ideally we would split this stuff | 221 // TODO(andrew): make this more graceful. Ideally we would split this stuff |
226 // out into a separate class with an "enabled" and "disabled" implementation. | 222 // out into a separate class with an "enabled" and "disabled" implementation. |
227 static int WriteMessageToDebugFile(FileWrapper* debug_file, | 223 static int WriteMessageToDebugFile(FileWrapper* debug_file, |
228 int64_t* filesize_limit_bytes, | |
229 rtc::CriticalSection* crit_debug, | 224 rtc::CriticalSection* crit_debug, |
230 ApmDebugDumpThreadState* debug_state); | 225 ApmDebugDumpThreadState* debug_state); |
231 int WriteInitMessage() EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); | 226 int WriteInitMessage() EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
232 | 227 |
233 // Writes Config message. If not |forced|, only writes the current config if | 228 // Writes Config message. If not |forced|, only writes the current config if |
234 // it is different from the last saved one; if |forced|, writes the config | 229 // it is different from the last saved one; if |forced|, writes the config |
235 // regardless of the last saved. | 230 // regardless of the last saved. |
236 int WriteConfigMessage(bool forced) EXCLUSIVE_LOCKS_REQUIRED(crit_capture_) | 231 int WriteConfigMessage(bool forced) EXCLUSIVE_LOCKS_REQUIRED(crit_capture_) |
237 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); | 232 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
238 | 233 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 332 |
338 struct ApmRenderState { | 333 struct ApmRenderState { |
339 rtc::scoped_ptr<AudioConverter> render_converter; | 334 rtc::scoped_ptr<AudioConverter> render_converter; |
340 rtc::scoped_ptr<AudioBuffer> render_audio; | 335 rtc::scoped_ptr<AudioBuffer> render_audio; |
341 } render_ GUARDED_BY(crit_render_); | 336 } render_ GUARDED_BY(crit_render_); |
342 }; | 337 }; |
343 | 338 |
344 } // namespace webrtc | 339 } // namespace webrtc |
345 | 340 |
346 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 341 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
OLD | NEW |