(Auto)update libjingle 67686255-> 67689476
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6216 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a148704b4b
commit
f9f1bfbdae
@ -203,4 +203,18 @@ int32 TimeDiff(uint32 later, uint32 earlier) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TimestampWrapAroundHandler::TimestampWrapAroundHandler()
|
||||||
|
: last_ts_(0), num_wrap_(0) {}
|
||||||
|
|
||||||
|
int64 TimestampWrapAroundHandler::Unwrap(uint32 ts) {
|
||||||
|
if (ts < last_ts_) {
|
||||||
|
if (last_ts_ > 0xf0000000 && ts < 0x0fffffff) {
|
||||||
|
++num_wrap_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
last_ts_ = ts;
|
||||||
|
int64_t unwrapped_ts = ts + (num_wrap_ << 32);
|
||||||
|
return unwrapped_ts;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace talk_base
|
} // namespace talk_base
|
||||||
|
@ -97,6 +97,17 @@ inline int64 UnixTimestampNanosecsToNtpMillisecs(int64 unix_ts_ns) {
|
|||||||
return unix_ts_ns / kNumNanosecsPerMillisec + kJan1970AsNtpMillisecs;
|
return unix_ts_ns / kNumNanosecsPerMillisec + kJan1970AsNtpMillisecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TimestampWrapAroundHandler {
|
||||||
|
public:
|
||||||
|
TimestampWrapAroundHandler();
|
||||||
|
|
||||||
|
int64 Unwrap(uint32 ts);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32 last_ts_;
|
||||||
|
int64 num_wrap_;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace talk_base
|
} // namespace talk_base
|
||||||
|
|
||||||
#endif // TALK_BASE_TIMEUTILS_H_
|
#endif // TALK_BASE_TIMEUTILS_H_
|
||||||
|
@ -160,4 +160,27 @@ TEST(TimeTest, DISABLED_CurrentTmTime) {
|
|||||||
EXPECT_TRUE(0 <= microseconds && microseconds < 1000000);
|
EXPECT_TRUE(0 <= microseconds && microseconds < 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TimestampWrapAroundHandlerTest : public testing::Test {
|
||||||
|
public:
|
||||||
|
TimestampWrapAroundHandlerTest() {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TimestampWrapAroundHandler wraparound_handler_;
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(TimestampWrapAroundHandlerTest, Unwrap) {
|
||||||
|
uint32 ts = 0xfffffff2;
|
||||||
|
int64 unwrapped_ts = ts;
|
||||||
|
EXPECT_EQ(ts, wraparound_handler_.Unwrap(ts));
|
||||||
|
ts = 2;
|
||||||
|
unwrapped_ts += 0x10;
|
||||||
|
EXPECT_EQ(unwrapped_ts, wraparound_handler_.Unwrap(ts));
|
||||||
|
ts = 0xfffffff2;
|
||||||
|
unwrapped_ts += 0xfffffff0;
|
||||||
|
EXPECT_EQ(unwrapped_ts, wraparound_handler_.Unwrap(ts));
|
||||||
|
ts = 0;
|
||||||
|
unwrapped_ts += 0xe;
|
||||||
|
EXPECT_EQ(unwrapped_ts, wraparound_handler_.Unwrap(ts));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace talk_base
|
} // namespace talk_base
|
||||||
|
@ -180,8 +180,7 @@ class WebRtcRenderAdapter : public webrtc::ExternalRenderer {
|
|||||||
channel_id_(channel_id),
|
channel_id_(channel_id),
|
||||||
width_(0),
|
width_(0),
|
||||||
height_(0),
|
height_(0),
|
||||||
first_frame_arrived_(false),
|
capture_start_rtp_time_stamp_(-1),
|
||||||
capture_start_rtp_time_stamp_(0),
|
|
||||||
capture_start_ntp_time_ms_(0) {
|
capture_start_ntp_time_ms_(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,8 +232,7 @@ class WebRtcRenderAdapter : public webrtc::ExternalRenderer {
|
|||||||
int64_t render_time,
|
int64_t render_time,
|
||||||
void* handle) {
|
void* handle) {
|
||||||
talk_base::CritScope cs(&crit_);
|
talk_base::CritScope cs(&crit_);
|
||||||
if (!first_frame_arrived_) {
|
if (capture_start_rtp_time_stamp_ < 0) {
|
||||||
first_frame_arrived_ = true;
|
|
||||||
capture_start_rtp_time_stamp_ = rtp_time_stamp;
|
capture_start_rtp_time_stamp_ = rtp_time_stamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,9 +240,9 @@ class WebRtcRenderAdapter : public webrtc::ExternalRenderer {
|
|||||||
|
|
||||||
#ifdef USE_WEBRTC_DEV_BRANCH
|
#ifdef USE_WEBRTC_DEV_BRANCH
|
||||||
if (ntp_time_ms > 0) {
|
if (ntp_time_ms > 0) {
|
||||||
uint32 elapsed_time_ms =
|
int64 elapsed_time_ms =
|
||||||
(rtp_time_stamp - capture_start_rtp_time_stamp_) /
|
(rtp_ts_wraparound_handler_.Unwrap(rtp_time_stamp) -
|
||||||
kVideoCodecClockratekHz;
|
capture_start_rtp_time_stamp_) / kVideoCodecClockratekHz;
|
||||||
capture_start_ntp_time_ms_ = ntp_time_ms - elapsed_time_ms;
|
capture_start_ntp_time_ms_ = ntp_time_ms - elapsed_time_ms;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -329,8 +327,8 @@ class WebRtcRenderAdapter : public webrtc::ExternalRenderer {
|
|||||||
unsigned int width_;
|
unsigned int width_;
|
||||||
unsigned int height_;
|
unsigned int height_;
|
||||||
talk_base::RateTracker frame_rate_tracker_;
|
talk_base::RateTracker frame_rate_tracker_;
|
||||||
bool first_frame_arrived_;
|
talk_base::TimestampWrapAroundHandler rtp_ts_wraparound_handler_;
|
||||||
uint32 capture_start_rtp_time_stamp_;
|
int64 capture_start_rtp_time_stamp_;
|
||||||
int64 capture_start_ntp_time_ms_;
|
int64 capture_start_ntp_time_ms_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user