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]) override; | 60 int StartDebugRecording(const char filename[kMaxFilenameSize], |
61 int StartDebugRecording(FILE* handle) override; | 61 int64_t max_log_size_bytes) override; |
| 62 int StartDebugRecording(FILE* handle, int64_t max_log_size_bytes) override; |
62 int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) override; | 63 int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) override; |
63 int StopDebugRecording() override; | 64 int StopDebugRecording() override; |
64 | 65 |
65 // Capture-side exclusive methods possibly running APM in a | 66 // Capture-side exclusive methods possibly running APM in a |
66 // multi-threaded manner. Acquire the capture lock. | 67 // multi-threaded manner. Acquire the capture lock. |
67 int ProcessStream(AudioFrame* frame) override; | 68 int ProcessStream(AudioFrame* frame) override; |
68 int ProcessStream(const float* const* src, | 69 int ProcessStream(const float* const* src, |
69 size_t samples_per_channel, | 70 size_t samples_per_channel, |
70 int input_sample_rate_hz, | 71 int input_sample_rate_hz, |
71 ChannelLayout input_layout, | 72 ChannelLayout input_layout, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} | 137 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} |
137 rtc::scoped_ptr<audioproc::Event> event_msg; // Protobuf message. | 138 rtc::scoped_ptr<audioproc::Event> event_msg; // Protobuf message. |
138 std::string event_str; // Memory for protobuf serialization. | 139 std::string event_str; // Memory for protobuf serialization. |
139 | 140 |
140 // Serialized string of last saved APM configuration. | 141 // Serialized string of last saved APM configuration. |
141 std::string last_serialized_config; | 142 std::string last_serialized_config; |
142 }; | 143 }; |
143 | 144 |
144 struct ApmDebugDumpState { | 145 struct ApmDebugDumpState { |
145 ApmDebugDumpState() : debug_file(FileWrapper::Create()) {} | 146 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; |
146 rtc::scoped_ptr<FileWrapper> debug_file; | 150 rtc::scoped_ptr<FileWrapper> debug_file; |
147 ApmDebugDumpThreadState render; | 151 ApmDebugDumpThreadState render; |
148 ApmDebugDumpThreadState capture; | 152 ApmDebugDumpThreadState capture; |
149 }; | 153 }; |
150 #endif | 154 #endif |
151 | 155 |
152 // Method for modifying the formats struct that are called from both | 156 // Method for modifying the formats struct that are called from both |
153 // the render and capture threads. The check for whether modifications | 157 // the render and capture threads. The check for whether modifications |
154 // are needed is done while holding the render lock only, thereby avoiding | 158 // are needed is done while holding the render lock only, thereby avoiding |
155 // that the capture thread blocks the render thread. | 159 // that the capture thread blocks the render thread. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 218 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
215 bool is_rev_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 219 bool is_rev_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
216 int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 220 int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
217 | 221 |
218 // Debug dump methods that are internal and called without locks. | 222 // Debug dump methods that are internal and called without locks. |
219 // TODO(peah): Make thread safe. | 223 // TODO(peah): Make thread safe. |
220 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 224 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
221 // TODO(andrew): make this more graceful. Ideally we would split this stuff | 225 // TODO(andrew): make this more graceful. Ideally we would split this stuff |
222 // out into a separate class with an "enabled" and "disabled" implementation. | 226 // out into a separate class with an "enabled" and "disabled" implementation. |
223 static int WriteMessageToDebugFile(FileWrapper* debug_file, | 227 static int WriteMessageToDebugFile(FileWrapper* debug_file, |
| 228 int64_t* filesize_limit_bytes, |
224 rtc::CriticalSection* crit_debug, | 229 rtc::CriticalSection* crit_debug, |
225 ApmDebugDumpThreadState* debug_state); | 230 ApmDebugDumpThreadState* debug_state); |
226 int WriteInitMessage() EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); | 231 int WriteInitMessage() EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
227 | 232 |
228 // Writes Config message. If not |forced|, only writes the current config if | 233 // 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 | 234 // it is different from the last saved one; if |forced|, writes the config |
230 // regardless of the last saved. | 235 // regardless of the last saved. |
231 int WriteConfigMessage(bool forced) EXCLUSIVE_LOCKS_REQUIRED(crit_capture_) | 236 int WriteConfigMessage(bool forced) EXCLUSIVE_LOCKS_REQUIRED(crit_capture_) |
232 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); | 237 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
233 | 238 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 337 |
333 struct ApmRenderState { | 338 struct ApmRenderState { |
334 rtc::scoped_ptr<AudioConverter> render_converter; | 339 rtc::scoped_ptr<AudioConverter> render_converter; |
335 rtc::scoped_ptr<AudioBuffer> render_audio; | 340 rtc::scoped_ptr<AudioBuffer> render_audio; |
336 } render_ GUARDED_BY(crit_render_); | 341 } render_ GUARDED_BY(crit_render_); |
337 }; | 342 }; |
338 | 343 |
339 } // namespace webrtc | 344 } // namespace webrtc |
340 | 345 |
341 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 346 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
OLD | NEW |