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

Side by Side Diff: webrtc/test/vcm_capturer.h

Issue 1411813004: Fix thread safety in VcmCapturer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/test/vcm_capturer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_ 10 #ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_
11 #define WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_ 11 #define WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_
12 12
13 #include "webrtc/base/criticalsection.h"
13 #include "webrtc/common_types.h" 14 #include "webrtc/common_types.h"
14 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 15 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
15 #include "webrtc/modules/video_capture/include/video_capture.h" 16 #include "webrtc/modules/video_capture/include/video_capture.h"
16 #include "webrtc/test/video_capturer.h" 17 #include "webrtc/test/video_capturer.h"
17 18
18 namespace webrtc { 19 namespace webrtc {
19 namespace test { 20 namespace test {
20 21
21 class VcmCapturer : public VideoCapturer, public VideoCaptureDataCallback { 22 class VcmCapturer : public VideoCapturer, public VideoCaptureDataCallback {
22 public: 23 public:
23 static VcmCapturer* Create(VideoCaptureInput* input, 24 static VcmCapturer* Create(VideoCaptureInput* input,
24 size_t width, 25 size_t width,
25 size_t height, 26 size_t height,
26 size_t target_fps); 27 size_t target_fps);
27 virtual ~VcmCapturer(); 28 virtual ~VcmCapturer();
28 29
29 void Start() override; 30 void Start() override;
30 void Stop() override; 31 void Stop() override;
31 32
32 void OnIncomingCapturedFrame(const int32_t id, 33 void OnIncomingCapturedFrame(const int32_t id,
33 const VideoFrame& frame) override; // NOLINT 34 const VideoFrame& frame) override; // NOLINT
34 void OnCaptureDelayChanged(const int32_t id, const int32_t delay) override; 35 void OnCaptureDelayChanged(const int32_t id, const int32_t delay) override;
35 36
36 private: 37 private:
37 explicit VcmCapturer(VideoCaptureInput* input); 38 explicit VcmCapturer(VideoCaptureInput* input);
38 bool Init(size_t width, size_t height, size_t target_fps); 39 bool Init(size_t width, size_t height, size_t target_fps);
39 void Destroy(); 40 void Destroy();
40 41
41 bool started_; 42 rtc::CriticalSection crit_;
43 bool started_ GUARDED_BY(crit_);
42 VideoCaptureModule* vcm_; 44 VideoCaptureModule* vcm_;
43 VideoCaptureCapability capability_; 45 VideoCaptureCapability capability_;
44 }; 46 };
45 } // test 47 } // test
46 } // webrtc 48 } // webrtc
47 49
48 #endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_ 50 #endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/test/vcm_capturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698