Revert of Create rtc::AtomicInt POD struct. (patchset #12 id:220001 of https://codereview.webrtc.org/1420043008/ )

Reason for revert:
Caused static initializers.

BUG=chromium:556866
TBR=tommi@webrtc.org

Original issue's description:
> Create rtc::AtomicInt POD struct.
>
> Prevents accidental non-atomic reads, increments and stores since
> "volatile int" doesn't enforce atomic usage.
>
> BUG=
> R=kwiberg@webrtc.org, tommi@webrtc.org
>
> Committed: https://crrev.com/b27f590ece487819c3d1fda400315e582fb975b6
> Cr-Commit-Position: refs/heads/master@{#10657}

TBR=kwiberg@webrtc.org,tommi@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

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

Cr-Commit-Position: refs/heads/master@{#10669}
diff --git a/webrtc/base/atomicops.h b/webrtc/base/atomicops.h
index 4c8ea89..a863566 100644
--- a/webrtc/base/atomicops.h
+++ b/webrtc/base/atomicops.h
@@ -20,10 +20,7 @@
 #include <windows.h>
 #endif  // defined(WEBRTC_WIN)
 
-#include "webrtc/base/constructormagic.h"
-
 namespace rtc {
-
 class AtomicOps {
  public:
 #if defined(WEBRTC_WIN)
@@ -64,46 +61,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.
-struct AtomicInt {
-  AtomicInt() : AtomicInt(0) {}
-  explicit AtomicInt(int value) : value_(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);
-  }
-
- private:
-  volatile int value_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(AtomicInt);
-};
 }
 
 #endif  // WEBRTC_BASE_ATOMICOPS_H_
diff --git a/webrtc/base/criticalsection.cc b/webrtc/base/criticalsection.cc
index 3cf4fed..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,11 +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";
 }
 
-GlobalLockScope::GlobalLockScope(GlobalLockPod* lock) : lock_(lock) {
+GlobalLock::GlobalLock() {
+  lock_acquired = 0;
+}
+
+GlobalLockScope::GlobalLockScope(GlobalLockPod* lock)
+    : lock_(lock) {
   lock_->Lock();
 }
 
diff --git a/webrtc/base/criticalsection.h b/webrtc/base/criticalsection.h
index a7571fe..ddbf857 100644
--- a/webrtc/base/criticalsection.h
+++ b/webrtc/base/criticalsection.h
@@ -106,10 +106,13 @@
 
   void Unlock() UNLOCK_FUNCTION();
 
-  AtomicInt lock_acquired;
+  volatile int lock_acquired;
 };
 
-class GlobalLock : public GlobalLockPod {};
+class GlobalLock : public GlobalLockPod {
+ public:
+  GlobalLock();
+};
 
 // GlobalLockScope, for serializing execution through a scope.
 class SCOPED_LOCKABLE GlobalLockScope {
diff --git a/webrtc/base/refcount.h b/webrtc/base/refcount.h
index 83e1735..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() {}
+  RefCountedObject() : ref_count_(0) {
+  }
 
-  template <typename P>
-  explicit RefCountedObject(P p)
-      : T(p) {}
+  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) {}
+  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) {}
+  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) {}
+      : 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) {}
+      : 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) {}
+      : 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) {}
+      : 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) {}
+      : 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) {}
+  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) {}
+  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) {}
+  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 784070b..8f8ba0a 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;
@@ -273,10 +268,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 c7b71f3..1466d6a 100644
--- a/webrtc/modules/audio_device/ios/audio_device_ios.mm
+++ b/webrtc/modules/audio_device/ios/audio_device_ios.mm
@@ -193,6 +193,8 @@
 AudioDeviceIOS::AudioDeviceIOS()
     : audio_device_buffer_(nullptr),
       vpio_unit_(nullptr),
+      recording_(0),
+      playing_(0),
       initialized_(false),
       rec_is_initialized_(false),
       play_is_initialized_(false),
@@ -254,7 +256,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!";
@@ -270,7 +272,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!";
@@ -285,30 +287,30 @@
   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: " << result;
       return -1;
     }
   }
-  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;
 }
 
@@ -316,30 +318,30 @@
   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: " << result;
       return -1;
     }
   }
-  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;
 }
 
@@ -849,7 +851,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.
@@ -908,7 +910,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 8f141b3..5fd3508 100644
--- a/webrtc/modules/pacing/packet_router.cc
+++ b/webrtc/modules/pacing/packet_router.cc
@@ -18,7 +18,8 @@
 
 namespace webrtc {
 
-PacketRouter::PacketRouter() {}
+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 ea34339..ffe79b9 100644
--- a/webrtc/system_wrappers/source/trace_impl.cc
+++ b/webrtc/system_wrappers/source/trace_impl.cc
@@ -33,7 +33,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,
@@ -547,12 +547,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 7e881eb..1f41649 100644
--- a/webrtc/video/video_capture_input.cc
+++ b/webrtc/video/video_capture_input.cc
@@ -46,6 +46,7 @@
                                                   this,
                                                   "EncoderThread")),
       capture_event_(EventWrapper::Create()),
+      stop_(0),
       last_captured_timestamp_(0),
       delta_ntp_internal_ms_(
           Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() -
@@ -64,7 +65,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();
 }
@@ -128,7 +129,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 cf50843..b93d803 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/scoped_ptr.h"
 #include "webrtc/base/thread_annotations.h"
@@ -82,7 +81,7 @@
   rtc::scoped_ptr<ThreadWrapper> 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.