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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} | 136 ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} |
136 rtc::scoped_ptr<audioproc::Event> event_msg; // Protobuf message. | 137 rtc::scoped_ptr<audioproc::Event> event_msg; // Protobuf message. |
137 std::string event_str; // Memory for protobuf serialization. | 138 std::string event_str; // Memory for protobuf serialization. |
138 | 139 |
139 // Serialized string of last saved APM configuration. | 140 // Serialized string of last saved APM configuration. |
140 std::string last_serialized_config; | 141 std::string last_serialized_config; |
141 }; | 142 }; |
142 | 143 |
143 struct ApmDebugDumpState { | 144 struct ApmDebugDumpState { |
144 ApmDebugDumpState() : debug_file(FileWrapper::Create()) {} | 145 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; |
145 rtc::scoped_ptr<FileWrapper> debug_file; | 149 rtc::scoped_ptr<FileWrapper> debug_file; |
146 ApmDebugDumpThreadState render; | 150 ApmDebugDumpThreadState render; |
147 ApmDebugDumpThreadState capture; | 151 ApmDebugDumpThreadState capture; |
148 }; | 152 }; |
149 #endif | 153 #endif |
150 | 154 |
151 // Method for modifying the formats struct that are called from both | 155 // Method for modifying the formats struct that are called from both |
152 // the render and capture threads. The check for whether modifications | 156 // the render and capture threads. The check for whether modifications |
153 // are needed is done while holding the render lock only, thereby avoiding | 157 // are needed is done while holding the render lock only, thereby avoiding |
154 // that the capture thread blocks the render thread. | 158 // that the capture thread blocks the render thread. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 213 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
210 bool is_rev_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 214 bool is_rev_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
211 int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 215 int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
212 | 216 |
213 // Debug dump methods that are internal and called without locks. | 217 // Debug dump methods that are internal and called without locks. |
214 // TODO(peah): Make thread safe. | 218 // TODO(peah): Make thread safe. |
215 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 219 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
216 // TODO(andrew): make this more graceful. Ideally we would split this stuff | 220 // TODO(andrew): make this more graceful. Ideally we would split this stuff |
217 // out into a separate class with an "enabled" and "disabled" implementation. | 221 // out into a separate class with an "enabled" and "disabled" implementation. |
218 static int WriteMessageToDebugFile(FileWrapper* debug_file, | 222 static int WriteMessageToDebugFile(FileWrapper* debug_file, |
| 223 int64_t* filesize_limit_bytes, |
219 rtc::CriticalSection* crit_debug, | 224 rtc::CriticalSection* crit_debug, |
220 ApmDebugDumpThreadState* debug_state); | 225 ApmDebugDumpThreadState* debug_state); |
221 int WriteInitMessage() EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); | 226 int WriteInitMessage() EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
222 | 227 |
223 // 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 |
224 // 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 |
225 // regardless of the last saved. | 230 // regardless of the last saved. |
226 int WriteConfigMessage(bool forced) EXCLUSIVE_LOCKS_REQUIRED(crit_capture_) | 231 int WriteConfigMessage(bool forced) EXCLUSIVE_LOCKS_REQUIRED(crit_capture_) |
227 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); | 232 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
228 | 233 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 332 |
328 struct ApmRenderState { | 333 struct ApmRenderState { |
329 rtc::scoped_ptr<AudioConverter> render_converter; | 334 rtc::scoped_ptr<AudioConverter> render_converter; |
330 rtc::scoped_ptr<AudioBuffer> render_audio; | 335 rtc::scoped_ptr<AudioBuffer> render_audio; |
331 } render_ GUARDED_BY(crit_render_); | 336 } render_ GUARDED_BY(crit_render_); |
332 }; | 337 }; |
333 | 338 |
334 } // namespace webrtc | 339 } // namespace webrtc |
335 | 340 |
336 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 341 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
OLD | NEW |