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

Unified Diff: webrtc/test/vcm_capturer.cc

Issue 1411813004: Fix thread safety in VcmCapturer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 months 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
« no previous file with comments | « webrtc/test/vcm_capturer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/vcm_capturer.cc
diff --git a/webrtc/test/vcm_capturer.cc b/webrtc/test/vcm_capturer.cc
index c37140f9392dc3966f09a86012a32ac662f1140f..1c6b91915e296383a31af2f3cdfb7bae3a61b52e 100644
--- a/webrtc/test/vcm_capturer.cc
+++ b/webrtc/test/vcm_capturer.cc
@@ -58,19 +58,25 @@ VcmCapturer* VcmCapturer::Create(VideoCaptureInput* input,
size_t width,
size_t height,
size_t target_fps) {
- VcmCapturer* vcm__capturer = new VcmCapturer(input);
- if (!vcm__capturer->Init(width, height, target_fps)) {
+ VcmCapturer* vcm_capturer = new VcmCapturer(input);
+ if (!vcm_capturer->Init(width, height, target_fps)) {
// TODO(pbos): Log a warning that this failed.
- delete vcm__capturer;
+ delete vcm_capturer;
return NULL;
}
- return vcm__capturer;
+ return vcm_capturer;
}
-void VcmCapturer::Start() { started_ = true; }
+void VcmCapturer::Start() {
+ rtc::CritScope lock(&crit_);
+ started_ = true;
+}
-void VcmCapturer::Stop() { started_ = false; }
+void VcmCapturer::Stop() {
+ rtc::CritScope lock(&crit_);
+ started_ = false;
+}
void VcmCapturer::Destroy() {
if (vcm_ == NULL) {
@@ -90,6 +96,7 @@ VcmCapturer::~VcmCapturer() { Destroy(); }
void VcmCapturer::OnIncomingCapturedFrame(const int32_t id,
const VideoFrame& frame) {
+ rtc::CritScope lock(&crit_);
if (started_)
input_->IncomingCapturedFrame(frame);
}
« no previous file with comments | « webrtc/test/vcm_capturer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698