Add a race-checking mechanism.

Permits CHECKing/DCHECKing that methods are being accessed in a
thread-safe manner, even if they are not used by one single thread
(thread pools such as VideoToolbox OK).

BUG=
R=danilchap@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/2097403002 .

Cr-Commit-Position: refs/heads/master@{#13358}
This commit is contained in:
Peter Boström
2016-07-01 12:45:15 +02:00
parent 9b0dc622d4
commit 02bafc6379
8 changed files with 144 additions and 4 deletions

View File

@ -18,6 +18,7 @@
#include "webrtc/modules/video_coding/include/video_coding_defines.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/race_checker.h"
namespace webrtc {
class CriticalSectionWrapper;
@ -82,7 +83,9 @@ class VCMGenericEncoder {
bool SupportsNativeHandle() const;
private:
VideoEncoder* const encoder_;
rtc::RaceChecker race_checker_;
VideoEncoder* const encoder_ GUARDED_BY(race_checker_);
VideoEncoderRateObserver* const rate_observer_;
VCMEncodedFrameCallback* const vcm_encoded_frame_callback_;
const bool internal_source_;