Add ThreadChecker to the TimestampAligner class.

BUG=

Review-Url: https://codereview.webrtc.org/2270773002
Cr-Commit-Position: refs/heads/master@{#13882}
This commit is contained in:
nisse 2016-08-24 01:58:42 -07:00 committed by Commit bot
parent 665d181ccc
commit 76f91cd08f
2 changed files with 11 additions and 1 deletions

View File

@ -13,11 +13,16 @@
namespace rtc {
TimestampAligner::TimestampAligner() : frames_seen_(0), offset_us_(0) {}
TimestampAligner::TimestampAligner() : frames_seen_(0), offset_us_(0) {
thread_checker_.DetachFromThread();
}
TimestampAligner::~TimestampAligner() {}
int64_t TimestampAligner::UpdateOffset(int64_t camera_time_us,
int64_t system_time_us) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
// Estimate the offset between system monotonic time and the capture
// time from the camera. The camera is assumed to provide more
// accurate timestamps than we get from the system time. But the
@ -86,6 +91,8 @@ int64_t TimestampAligner::UpdateOffset(int64_t camera_time_us,
int64_t TimestampAligner::ClipTimestamp(int64_t time_us,
int64_t system_time_us) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
// Make timestamps monotonic.
if (!prev_translated_time_us_) {
// Initialize.

View File

@ -14,6 +14,7 @@
#include "webrtc/base/basictypes.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/optional.h"
#include "webrtc/base/thread_checker.h"
namespace rtc {
@ -29,6 +30,8 @@ class TimestampAligner {
int64_t ClipTimestamp(int64_t filtered_time_us, int64_t system_time_us);
private:
rtc::ThreadChecker thread_checker_;
// State for the timestamp translation.
int frames_seen_;
// Estimated offset between camera time and system monotonic time.