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