Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Unified Diff: webrtc/modules/audio_processing/echo_control_mobile_impl.h

Issue 1424663003: Lock scheme #8: Introduced the new locking scheme (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@add_threadcheckers_CL
Patch Set: Changes in response to reviewer comments Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/echo_control_mobile_impl.h
diff --git a/webrtc/modules/audio_processing/echo_control_mobile_impl.h b/webrtc/modules/audio_processing/echo_control_mobile_impl.h
index a9ce76ff63f9bdf53491565c5fab2653e95084b7..1b8663fb1e4b4998dd742fbb50e651aca87f2a28 100644
--- a/webrtc/modules/audio_processing/echo_control_mobile_impl.h
+++ b/webrtc/modules/audio_processing/echo_control_mobile_impl.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_
+#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/common_audio/swap_queue.h"
@@ -20,50 +21,71 @@
namespace webrtc {
class AudioBuffer;
-class CriticalSectionWrapper;
class EchoControlMobileImpl : public EchoControlMobile,
public ProcessingComponent {
public:
EchoControlMobileImpl(const AudioProcessing* apm,
- CriticalSectionWrapper* crit,
+ rtc::CriticalSection* crit_render,
+ rtc::CriticalSection* crit_capture,
const rtc::ThreadChecker* render_thread_checker);
+
virtual ~EchoControlMobileImpl();
+ // Called holding the render lock.
int ProcessRenderAudio(const AudioBuffer* audio);
+ // Called holding the capture lock.
int ProcessCaptureAudio(AudioBuffer* audio);
// EchoControlMobile implementation.
+ // Aquires the capture lock.
bool is_enabled() const override;
+ // Aquires the capture lock.
RoutingMode routing_mode() const override;
+ // Aquires the capture lock.
bool is_comfort_noise_enabled() const override;
// ProcessingComponent implementation.
+ // Called holding both the render and capture locks.
int Initialize() override;
// Reads render side data that has been queued on the render call.
+ // Called holding the capture lock.
void ReadQueuedRenderData();
private:
// EchoControlMobile implementation.
+ // Aquires both the render and capture locks.
int Enable(bool enable) override;
+ // Aquires the capture lock.
int set_routing_mode(RoutingMode mode) override;
+ // Aquires the capture lock.
int enable_comfort_noise(bool enable) override;
+ // Aquires both the capture and render locks.
int SetEchoPath(const void* echo_path, size_t size_bytes) override;
+ // Aquires the capture lock.
int GetEchoPath(void* echo_path, size_t size_bytes) const override;
// ProcessingComponent implementation.
+ // Called holding both the render and capture locks.
void* CreateHandle() const override;
+ // Called holding both the render and capture locks.
int InitializeHandle(void* handle) const override;
+ // Called holding both the render and capture locks.
int ConfigureHandle(void* handle) const override;
+ // Called holding both the render and capture locks.
void DestroyHandle(void* handle) const override;
+ // Called holding both the render and capture locks.
int num_handles_required() const override;
+ // Called holding both the render and capture locks.
int GetHandleError(void* handle) const override;
+ // Called holding both the render and capture locks.
void AllocateRenderQueue();
const AudioProcessing* apm_;
- CriticalSectionWrapper* crit_;
+ rtc::CriticalSection* const crit_render_;
+ rtc::CriticalSection* const crit_capture_;
const rtc::ThreadChecker* const render_thread_checker_;
RoutingMode routing_mode_;
bool comfort_noise_enabled_;
@@ -72,6 +94,8 @@ class EchoControlMobileImpl : public EchoControlMobile,
size_t render_queue_element_max_size_;
std::vector<int16_t> render_queue_buffer_;
std::vector<int16_t> capture_queue_buffer_;
+
+ // Lock protection not needed.
rtc::scoped_ptr<
SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>>
render_signal_queue_;

Powered by Google App Engine
This is Rietveld 408576698