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
This commit is contained in:
pbos@webrtc.org 2014-07-10 15:25:37 +00:00
parent bd9c0920ec
commit 0422100818
2 changed files with 17 additions and 13 deletions

View File

@ -58,6 +58,7 @@ void VCMTiming::Reset() {
}
void VCMTiming::ResetDecodeTime() {
CriticalSectionScoped lock(crit_sect_);
codec_timer_.Reset();
}

View File

@ -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 @@ class VCMTiming {
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