Revert of "Create rtc::AtomicInt POD struct." (patchset #3 id:40001 of https://codereview.webrtc.org/1498953002/ )
Reason for revert:
Broke downstream compile step, possibly relandable when using a MSVC version that has constexpr, other than that I'm out of ideas.
.../webrtc/base/atomicops.h:71:8: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const rtc::AtomicInt&'
Original issue's description:
> Reland of "Create rtc::AtomicInt POD struct."
>
> Relands https://codereview.webrtc.org/1420043008/ with brace initializers
> instead of constructors hoping that they won't introduce static
> initializers.
>
> BUG=
> R=tommi@webrtc.org
>
> Committed: https://crrev.com/84f0970d100e67a1dc4fe9a1b16b7d293302044e
> Cr-Commit-Position: refs/heads/master@{#10920}
TBR=tommi@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=
Review URL: https://codereview.webrtc.org/1505053002
Cr-Commit-Position: refs/heads/master@{#10922}
diff --git a/talk/session/media/srtpfilter.cc b/talk/session/media/srtpfilter.cc
index fdc379e..4a54740 100644
--- a/talk/session/media/srtpfilter.cc
+++ b/talk/session/media/srtpfilter.cc
@@ -484,7 +484,7 @@
bool SrtpSession::inited_ = false;
// This lock protects SrtpSession::inited_ and SrtpSession::sessions_.
-rtc::GlobalLockPod SrtpSession::lock_ = {{0}};
+rtc::GlobalLockPod SrtpSession::lock_;
SrtpSession::SrtpSession()
: session_(NULL),
diff --git a/webrtc/base/atomicops.h b/webrtc/base/atomicops.h
index 42b8709..188cd3f 100644
--- a/webrtc/base/atomicops.h
+++ b/webrtc/base/atomicops.h
@@ -21,7 +21,6 @@
#endif // defined(WEBRTC_WIN)
namespace rtc {
-
class AtomicOps {
public:
#if defined(WEBRTC_WIN)
@@ -81,50 +80,8 @@
#endif
};
-// POD struct version of AtomicOps, prevents accidental non-atomic operator
-// usage (such as ++, -- or =). Functions are static, so that the AtomicInt::
-// prefix must be present in the code, clearly labeling the operations as
-// atomic.
-// Do not copy-initialize, since that performs non-atomic reads of value_. The
-// copy constructor needs to be present for brace initialization.
-struct AtomicInt {
- AtomicInt() = delete;
- // TODO(pbos): When MSVC allows brace initialization (or we move to
- // std::atomic), remove copy constructor (or have it implicitly removed by
- // std::atomic).
- void operator=(const AtomicInt&) = delete;
- // value_ is public to permit brace initialization. Should not be accessed
- // directly.
- volatile int value_;
- // Atomically increments |i|, returns the resulting incremented value.
- static int Increment(AtomicInt* i) {
- return AtomicOps::Increment(&i->value_);
- }
-
- // Atomically decrements |i|, returns the resulting decremented value.
- static int Decrement(AtomicInt* i) {
- return AtomicOps::Decrement(&i->value_);
- }
-
- // Atomically loads |i|.
- static int AcquireLoad(const AtomicInt* i) {
- return AtomicOps::AcquireLoad(&i->value_);
- }
-
- // Atomically stores |value| in |i|.
- static void ReleaseStore(AtomicInt* i, int value) {
- AtomicOps::ReleaseStore(&i->value_, value);
- }
-
- // Attempts to compare-and-swaps |old_value| for |new_value| in |i| , returns
- // |i|'s initial value. If equal to |old_value|, then the CAS succeeded,
- // otherwise no operation is performed.
- static int CompareAndSwap(AtomicInt* i, int old_value, int new_value) {
- return AtomicOps::CompareAndSwap(&i->value_, old_value, new_value);
- }
-};
}
#endif // WEBRTC_BASE_ATOMICOPS_H_
diff --git a/webrtc/base/criticalsection.cc b/webrtc/base/criticalsection.cc
index 97322f4..1f50c23 100644
--- a/webrtc/base/criticalsection.cc
+++ b/webrtc/base/criticalsection.cc
@@ -139,7 +139,7 @@
const struct timespec ts_null = {0};
#endif
- while (AtomicInt::CompareAndSwap(&lock_acquired, 0, 1)) {
+ while (AtomicOps::CompareAndSwap(&lock_acquired, 0, 1)) {
#if defined(WEBRTC_WIN)
::Sleep(0);
#else
@@ -149,13 +149,16 @@
}
void GlobalLockPod::Unlock() {
- int old_value = AtomicInt::CompareAndSwap(&lock_acquired, 1, 0);
+ int old_value = AtomicOps::CompareAndSwap(&lock_acquired, 1, 0);
RTC_DCHECK_EQ(1, old_value) << "Unlock called without calling Lock first";
}
-GlobalLock::GlobalLock() : GlobalLockPod({{0}}) {}
+GlobalLock::GlobalLock() {
+ lock_acquired = 0;
+}
-GlobalLockScope::GlobalLockScope(GlobalLockPod* lock) : lock_(lock) {
+GlobalLockScope::GlobalLockScope(GlobalLockPod* lock)
+ : lock_(lock) {
lock_->Lock();
}
diff --git a/webrtc/base/criticalsection.h b/webrtc/base/criticalsection.h
index ed3998b..ddbf857 100644
--- a/webrtc/base/criticalsection.h
+++ b/webrtc/base/criticalsection.h
@@ -106,7 +106,7 @@
void Unlock() UNLOCK_FUNCTION();
- AtomicInt lock_acquired;
+ volatile int lock_acquired;
};
class GlobalLock : public GlobalLockPod {
diff --git a/webrtc/base/refcount.h b/webrtc/base/refcount.h
index f655602..55ce23a 100644
--- a/webrtc/base/refcount.h
+++ b/webrtc/base/refcount.h
@@ -29,128 +29,78 @@
template <class T>
class RefCountedObject : public T {
public:
- RefCountedObject() : ref_count_({0}) {}
+ RefCountedObject() : ref_count_(0) {
+ }
- template <typename P>
- explicit RefCountedObject(P p)
- : T(p), ref_count_({0}) {}
+ template<typename P>
+ explicit RefCountedObject(P p) : T(p), ref_count_(0) {
+ }
- template <typename P1, typename P2>
- RefCountedObject(P1 p1, P2 p2)
- : T(p1, p2), ref_count_({0}) {}
+ template<typename P1, typename P2>
+ RefCountedObject(P1 p1, P2 p2) : T(p1, p2), ref_count_(0) {
+ }
- template <typename P1, typename P2, typename P3>
- RefCountedObject(P1 p1, P2 p2, P3 p3)
- : T(p1, p2, p3), ref_count_({0}) {}
+ template<typename P1, typename P2, typename P3>
+ RefCountedObject(P1 p1, P2 p2, P3 p3) : T(p1, p2, p3), ref_count_(0) {
+ }
- template <typename P1, typename P2, typename P3, typename P4>
+ template<typename P1, typename P2, typename P3, typename P4>
RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4)
- : T(p1, p2, p3, p4), ref_count_({0}) {}
+ : T(p1, p2, p3, p4), ref_count_(0) {
+ }
- template <typename P1, typename P2, typename P3, typename P4, typename P5>
+ template<typename P1, typename P2, typename P3, typename P4, typename P5>
RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
- : T(p1, p2, p3, p4, p5), ref_count_({0}) {}
+ : T(p1, p2, p3, p4, p5), ref_count_(0) {
+ }
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6>
+ template<typename P1, typename P2, typename P3, typename P4, typename P5,
+ typename P6>
RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
- : T(p1, p2, p3, p4, p5, p6), ref_count_({0}) {}
+ : T(p1, p2, p3, p4, p5, p6), ref_count_(0) {
+ }
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6,
- typename P7>
+ template<typename P1, typename P2, typename P3, typename P4, typename P5,
+ typename P6, typename P7>
RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
- : T(p1, p2, p3, p4, p5, p6, p7), ref_count_({0}) {}
+ : T(p1, p2, p3, p4, p5, p6, p7), ref_count_(0) {
+ }
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6,
- typename P7,
- typename P8>
+ template<typename P1, typename P2, typename P3, typename P4, typename P5,
+ typename P6, typename P7, typename P8>
RefCountedObject(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
- : T(p1, p2, p3, p4, p5, p6, p7, p8), ref_count_({0}) {}
+ : T(p1, p2, p3, p4, p5, p6, p7, p8), ref_count_(0) {
+ }
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6,
- typename P7,
- typename P8,
- typename P9>
- RefCountedObject(P1 p1,
- P2 p2,
- P3 p3,
- P4 p4,
- P5 p5,
- P6 p6,
- P7 p7,
- P8 p8,
- P9 p9)
- : T(p1, p2, p3, p4, p5, p6, p7, p8, p9), ref_count_({0}) {}
+ template<typename P1, typename P2, typename P3, typename P4, typename P5,
+ typename P6, typename P7, typename P8, typename P9>
+ RefCountedObject(
+ P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9)
+ : T(p1, p2, p3, p4, p5, p6, p7, p8, p9), ref_count_(0) {
+ }
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6,
- typename P7,
- typename P8,
- typename P9,
- typename P10>
- RefCountedObject(P1 p1,
- P2 p2,
- P3 p3,
- P4 p4,
- P5 p5,
- P6 p6,
- P7 p7,
- P8 p8,
- P9 p9,
- P10 p10)
- : T(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10), ref_count_({0}) {}
+ template<typename P1, typename P2, typename P3, typename P4, typename P5,
+ typename P6, typename P7, typename P8, typename P9, typename P10>
+ RefCountedObject(
+ P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10)
+ : T(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10), ref_count_(0) {
+ }
- template <typename P1,
- typename P2,
- typename P3,
- typename P4,
- typename P5,
- typename P6,
- typename P7,
- typename P8,
- typename P9,
- typename P10,
- typename P11>
- RefCountedObject(P1 p1,
- P2 p2,
- P3 p3,
- P4 p4,
- P5 p5,
- P6 p6,
- P7 p7,
- P8 p8,
- P9 p9,
- P10 p10,
- P11 p11)
- : T(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11), ref_count_({0}) {}
+ template<typename P1, typename P2, typename P3, typename P4, typename P5,
+ typename P6, typename P7, typename P8, typename P9, typename P10,
+ typename P11>
+ RefCountedObject(
+ P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10,
+ P11 p11)
+ : T(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11), ref_count_(0) {
+ }
- virtual int AddRef() const { return AtomicInt::Increment(&ref_count_); }
+ virtual int AddRef() const {
+ return AtomicOps::Increment(&ref_count_);
+ }
virtual int Release() const {
- int count = AtomicInt::Decrement(&ref_count_);
+ int count = AtomicOps::Decrement(&ref_count_);
if (!count) {
delete this;
}
@@ -164,14 +114,14 @@
// barrier needed for the owning thread to act on the object, knowing that it
// has exclusive access to the object.
virtual bool HasOneRef() const {
- return AtomicInt::AcquireLoad(&ref_count_) == 1;
+ return AtomicOps::AcquireLoad(&ref_count_) == 1;
}
protected:
virtual ~RefCountedObject() {
}
- mutable AtomicInt ref_count_;
+ mutable volatile int ref_count_;
};
} // namespace rtc
diff --git a/webrtc/modules/audio_device/ios/audio_device_ios.h b/webrtc/modules/audio_device/ios/audio_device_ios.h
index 1bac27d..c4eb0d6 100644
--- a/webrtc/modules/audio_device/ios/audio_device_ios.h
+++ b/webrtc/modules/audio_device/ios/audio_device_ios.h
@@ -13,7 +13,6 @@
#include <AudioUnit/AudioUnit.h>
-#include "webrtc/base/atomicops.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/modules/audio_device/audio_device_generic.h"
@@ -54,15 +53,11 @@
int32_t StartPlayout() override;
int32_t StopPlayout() override;
- bool Playing() const override {
- return rtc::AtomicInt::AcquireLoad(&playing_) != 0;
- }
+ bool Playing() const override { return playing_; }
int32_t StartRecording() override;
int32_t StopRecording() override;
- bool Recording() const override {
- return rtc::AtomicInt::AcquireLoad(&recording_) != 0;
- }
+ bool Recording() const override { return recording_; }
int32_t SetLoudspeakerStatus(bool enable) override;
int32_t GetLoudspeakerStatus(bool& enabled) const override;
@@ -276,10 +271,10 @@
rtc::scoped_ptr<SInt8[]> record_audio_buffer_;
// Set to 1 when recording is active and 0 otherwise.
- rtc::AtomicInt recording_;
+ volatile int recording_;
// Set to 1 when playout is active and 0 otherwise.
- rtc::AtomicInt playing_;
+ volatile int playing_;
// Set to true after successful call to Init(), false otherwise.
bool initialized_;
diff --git a/webrtc/modules/audio_device/ios/audio_device_ios.mm b/webrtc/modules/audio_device/ios/audio_device_ios.mm
index 95834d2..b0d26be 100644
--- a/webrtc/modules/audio_device/ios/audio_device_ios.mm
+++ b/webrtc/modules/audio_device/ios/audio_device_ios.mm
@@ -28,7 +28,7 @@
namespace webrtc {
// Protects |g_audio_session_users|.
-static rtc::GlobalLockPod g_lock = {{0}};
+static rtc::GlobalLockPod g_lock;
// Counts number of users (=instances of this object) who needs an active
// audio session. This variable is used to ensure that we only activate an audio
@@ -288,8 +288,8 @@
AudioDeviceIOS::AudioDeviceIOS()
: audio_device_buffer_(nullptr),
vpio_unit_(nullptr),
- recording_({0}),
- playing_({0}),
+ recording_(0),
+ playing_(0),
initialized_(false),
rec_is_initialized_(false),
play_is_initialized_(false),
@@ -359,7 +359,7 @@
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(initialized_);
RTC_DCHECK(!play_is_initialized_);
- RTC_DCHECK(!Playing());
+ RTC_DCHECK(!playing_);
if (!rec_is_initialized_) {
if (!InitPlayOrRecord()) {
LOG_F(LS_ERROR) << "InitPlayOrRecord failed for InitPlayout!";
@@ -375,7 +375,7 @@
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(initialized_);
RTC_DCHECK(!rec_is_initialized_);
- RTC_DCHECK(!Recording());
+ RTC_DCHECK(!recording_);
if (!play_is_initialized_) {
if (!InitPlayOrRecord()) {
LOG_F(LS_ERROR) << "InitPlayOrRecord failed for InitRecording!";
@@ -390,9 +390,9 @@
LOGI() << "StartPlayout";
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(play_is_initialized_);
- RTC_DCHECK(!Playing());
+ RTC_DCHECK(!playing_);
fine_audio_buffer_->ResetPlayout();
- if (!Recording()) {
+ if (!recording_) {
OSStatus result = AudioOutputUnitStart(vpio_unit_);
if (result != noErr) {
LOG_F(LS_ERROR) << "AudioOutputUnitStart failed for StartPlayout: "
@@ -401,21 +401,21 @@
}
LOG(LS_INFO) << "Voice-Processing I/O audio unit is now started";
}
- rtc::AtomicInt::ReleaseStore(&playing_, 1);
+ rtc::AtomicOps::ReleaseStore(&playing_, 1);
return 0;
}
int32_t AudioDeviceIOS::StopPlayout() {
LOGI() << "StopPlayout";
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- if (!play_is_initialized_ || !Playing()) {
+ if (!play_is_initialized_ || !playing_) {
return 0;
}
- if (!Recording()) {
+ if (!recording_) {
ShutdownPlayOrRecord();
}
play_is_initialized_ = false;
- rtc::AtomicInt::ReleaseStore(&playing_, 0);
+ rtc::AtomicOps::ReleaseStore(&playing_, 0);
return 0;
}
@@ -423,9 +423,9 @@
LOGI() << "StartRecording";
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(rec_is_initialized_);
- RTC_DCHECK(!Recording());
+ RTC_DCHECK(!recording_);
fine_audio_buffer_->ResetRecord();
- if (!Playing()) {
+ if (!playing_) {
OSStatus result = AudioOutputUnitStart(vpio_unit_);
if (result != noErr) {
LOG_F(LS_ERROR) << "AudioOutputUnitStart failed for StartRecording: "
@@ -434,21 +434,21 @@
}
LOG(LS_INFO) << "Voice-Processing I/O audio unit is now started";
}
- rtc::AtomicInt::ReleaseStore(&recording_, 1);
+ rtc::AtomicOps::ReleaseStore(&recording_, 1);
return 0;
}
int32_t AudioDeviceIOS::StopRecording() {
LOGI() << "StopRecording";
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- if (!rec_is_initialized_ || !Recording()) {
+ if (!rec_is_initialized_ || !recording_) {
return 0;
}
- if (!Playing()) {
+ if (!playing_) {
ShutdownPlayOrRecord();
}
rec_is_initialized_ = false;
- rtc::AtomicInt::ReleaseStore(&recording_, 0);
+ rtc::AtomicOps::ReleaseStore(&recording_, 0);
return 0;
}
@@ -1028,7 +1028,7 @@
UInt32 in_number_frames) {
OSStatus result = noErr;
// Simply return if recording is not enabled.
- if (!Recording())
+ if (!rtc::AtomicOps::AcquireLoad(&recording_))
return result;
if (in_number_frames != record_parameters_.frames_per_buffer()) {
// We have seen short bursts (1-2 frames) where |in_number_frames| changes.
@@ -1087,7 +1087,7 @@
SInt8* destination = static_cast<SInt8*>(io_data->mBuffers[0].mData);
// Produce silence and give audio unit a hint about it if playout is not
// activated.
- if (!Playing()) {
+ if (!rtc::AtomicOps::AcquireLoad(&playing_)) {
*io_action_flags |= kAudioUnitRenderAction_OutputIsSilence;
memset(destination, 0, dataSizeInBytes);
return noErr;
diff --git a/webrtc/modules/pacing/packet_router.cc b/webrtc/modules/pacing/packet_router.cc
index 301585f..5fd3508 100644
--- a/webrtc/modules/pacing/packet_router.cc
+++ b/webrtc/modules/pacing/packet_router.cc
@@ -18,7 +18,8 @@
namespace webrtc {
-PacketRouter::PacketRouter() : transport_seq_({0}) {}
+PacketRouter::PacketRouter() : transport_seq_(0) {
+}
PacketRouter::~PacketRouter() {
RTC_DCHECK(rtp_modules_.empty());
@@ -68,11 +69,11 @@
}
void PacketRouter::SetTransportWideSequenceNumber(uint16_t sequence_number) {
- rtc::AtomicInt::ReleaseStore(&transport_seq_, sequence_number);
+ rtc::AtomicOps::ReleaseStore(&transport_seq_, sequence_number);
}
uint16_t PacketRouter::AllocateSequenceNumber() {
- int prev_seq = rtc::AtomicInt::AcquireLoad(&transport_seq_);
+ int prev_seq = rtc::AtomicOps::AcquireLoad(&transport_seq_);
int desired_prev_seq;
int new_seq;
do {
@@ -82,7 +83,7 @@
// time the CAS operation was executed. Thus, if prev_seq is returned, the
// operation was successful - otherwise we need to retry. Saving the
// return value saves us a load on retry.
- prev_seq = rtc::AtomicInt::CompareAndSwap(&transport_seq_, desired_prev_seq,
+ prev_seq = rtc::AtomicOps::CompareAndSwap(&transport_seq_, desired_prev_seq,
new_seq);
} while (prev_seq != desired_prev_seq);
diff --git a/webrtc/modules/pacing/packet_router.h b/webrtc/modules/pacing/packet_router.h
index 50913b5..edef1aa 100644
--- a/webrtc/modules/pacing/packet_router.h
+++ b/webrtc/modules/pacing/packet_router.h
@@ -13,7 +13,6 @@
#include <list>
-#include "webrtc/base/atomicops.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
@@ -59,7 +58,7 @@
// Map from ssrc to sending rtp module.
std::list<RtpRtcp*> rtp_modules_ GUARDED_BY(modules_lock_);
- rtc::AtomicInt transport_seq_;
+ volatile int transport_seq_;
RTC_DISALLOW_COPY_AND_ASSIGN(PacketRouter);
};
diff --git a/webrtc/system_wrappers/include/trace.h b/webrtc/system_wrappers/include/trace.h
index 6b401e8..25a3d74 100644
--- a/webrtc/system_wrappers/include/trace.h
+++ b/webrtc/system_wrappers/include/trace.h
@@ -16,7 +16,6 @@
#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TRACE_H_
#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TRACE_H_
-#include "webrtc/base/atomicops.h"
#include "webrtc/common_types.h"
#include "webrtc/typedefs.h"
@@ -85,7 +84,7 @@
const char* msg, ...);
private:
- static rtc::AtomicInt level_filter_;
+ static volatile int level_filter_;
};
} // namespace webrtc
diff --git a/webrtc/system_wrappers/source/trace_impl.cc b/webrtc/system_wrappers/source/trace_impl.cc
index 3bf1f1b..5029f5a 100644
--- a/webrtc/system_wrappers/source/trace_impl.cc
+++ b/webrtc/system_wrappers/source/trace_impl.cc
@@ -34,7 +34,7 @@
const int Trace::kBoilerplateLength = 71;
const int Trace::kTimestampPosition = 13;
const int Trace::kTimestampLength = 12;
-rtc::AtomicInt Trace::level_filter_ = {kTraceDefault};
+volatile int Trace::level_filter_ = kTraceDefault;
// Construct On First Use idiom. Avoids "static initialization order fiasco".
TraceImpl* TraceImpl::StaticInstance(CountOperation count_operation,
@@ -548,12 +548,12 @@
// static
void Trace::set_level_filter(int filter) {
- rtc::AtomicInt::ReleaseStore(&level_filter_, filter);
+ rtc::AtomicOps::ReleaseStore(&level_filter_, filter);
}
// static
int Trace::level_filter() {
- return rtc::AtomicInt::AcquireLoad(&level_filter_);
+ return rtc::AtomicOps::AcquireLoad(&level_filter_);
}
// static
diff --git a/webrtc/video/video_capture_input.cc b/webrtc/video/video_capture_input.cc
index eaacf72..ac05e36 100644
--- a/webrtc/video/video_capture_input.cc
+++ b/webrtc/video/video_capture_input.cc
@@ -44,7 +44,7 @@
incoming_frame_cs_(CriticalSectionWrapper::CreateCriticalSection()),
encoder_thread_(EncoderThreadFunction, this, "EncoderThread"),
capture_event_(EventWrapper::Create()),
- stop_({0}),
+ stop_(0),
last_captured_timestamp_(0),
delta_ntp_internal_ms_(
Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() -
@@ -63,7 +63,7 @@
module_process_thread_->DeRegisterModule(overuse_detector_.get());
// Stop the thread.
- rtc::AtomicInt::ReleaseStore(&stop_, 1);
+ rtc::AtomicOps::ReleaseStore(&stop_, 1);
capture_event_->Set();
encoder_thread_.Stop();
}
@@ -127,7 +127,7 @@
static const int kThreadWaitTimeMs = 100;
int64_t capture_time = -1;
if (capture_event_->Wait(kThreadWaitTimeMs) == kEventSignaled) {
- if (rtc::AtomicInt::AcquireLoad(&stop_))
+ if (rtc::AtomicOps::AcquireLoad(&stop_))
return false;
int64_t encode_start_time = -1;
diff --git a/webrtc/video/video_capture_input.h b/webrtc/video/video_capture_input.h
index b76c929..9a5aae3 100644
--- a/webrtc/video/video_capture_input.h
+++ b/webrtc/video/video_capture_input.h
@@ -13,7 +13,6 @@
#include <vector>
-#include "webrtc/base/atomicops.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/platform_thread.h"
#include "webrtc/base/scoped_ptr.h"
@@ -82,7 +81,7 @@
rtc::PlatformThread encoder_thread_;
rtc::scoped_ptr<EventWrapper> capture_event_;
- rtc::AtomicInt stop_;
+ volatile int stop_;
VideoFrame captured_frame_ GUARDED_BY(capture_cs_.get());
// Used to make sure incoming time stamp is increasing for every frame.