Fix data race in VCMTiming::ResetDecodeTime.

Also thread annotating class.

BUG=
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/17939004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6653 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/video_coding/main/source/timing.cc b/webrtc/modules/video_coding/main/source/timing.cc
index af0e35c..2ec149c 100644
--- a/webrtc/modules/video_coding/main/source/timing.cc
+++ b/webrtc/modules/video_coding/main/source/timing.cc
@@ -58,6 +58,7 @@
 }
 
 void VCMTiming::ResetDecodeTime() {
+  CriticalSectionScoped lock(crit_sect_);
   codec_timer_.Reset();
 }
 
diff --git a/webrtc/modules/video_coding/main/source/timing.h b/webrtc/modules/video_coding/main/source/timing.h
index 1dca5e6..116639e 100644
--- a/webrtc/modules/video_coding/main/source/timing.h
+++ b/webrtc/modules/video_coding/main/source/timing.h
@@ -13,6 +13,7 @@
 
 #include "webrtc/modules/video_coding/main/source/codec_timer.h"
 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
+#include "webrtc/system_wrappers/interface/thread_annotations.h"
 #include "webrtc/typedefs.h"
 
 namespace webrtc {
@@ -93,22 +94,24 @@
   enum { kDelayMaxChangeMsPerS = 100 };
 
  protected:
-  int32_t MaxDecodeTimeMs(FrameType frame_type = kVideoFrameDelta) const;
-  int64_t RenderTimeMsInternal(uint32_t frame_timestamp, int64_t now_ms) const;
-  uint32_t TargetDelayInternal() const;
+  int32_t MaxDecodeTimeMs(FrameType frame_type = kVideoFrameDelta) const
+      EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+  int64_t RenderTimeMsInternal(uint32_t frame_timestamp, int64_t now_ms) const
+      EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+  uint32_t TargetDelayInternal() const EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
 
  private:
   CriticalSectionWrapper* crit_sect_;
-  Clock* clock_;
-  bool master_;
-  TimestampExtrapolator* ts_extrapolator_;
-  VCMCodecTimer codec_timer_;
-  uint32_t render_delay_ms_;
-  uint32_t min_playout_delay_ms_;
-  uint32_t jitter_delay_ms_;
-  uint32_t current_delay_ms_;
-  int last_decode_ms_;
-  uint32_t prev_frame_timestamp_;
+  Clock* const clock_;
+  bool master_ GUARDED_BY(crit_sect_);
+  TimestampExtrapolator* ts_extrapolator_ GUARDED_BY(crit_sect_);
+  VCMCodecTimer codec_timer_ GUARDED_BY(crit_sect_);
+  uint32_t render_delay_ms_ GUARDED_BY(crit_sect_);
+  uint32_t min_playout_delay_ms_ GUARDED_BY(crit_sect_);
+  uint32_t jitter_delay_ms_ GUARDED_BY(crit_sect_);
+  uint32_t current_delay_ms_ GUARDED_BY(crit_sect_);
+  int last_decode_ms_ GUARDED_BY(crit_sect_);
+  uint32_t prev_frame_timestamp_ GUARDED_BY(crit_sect_);
 };
 }  // namespace webrtc