Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(682)

Unified Diff: webrtc/video/stream_synchronization_unittest.cc

Issue 2435053004: Use NtpTime in RtcpMeasurement instead of uint sec/uint frac. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/rtp_streams_synchronizer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/stream_synchronization_unittest.cc
diff --git a/webrtc/video/stream_synchronization_unittest.cc b/webrtc/video/stream_synchronization_unittest.cc
index d328d6af437ff5c8761f73ecbc46e425efa9beb8..2ebd184d425968871b1b7a1334a46f7cf5f0f960 100644
--- a/webrtc/video/stream_synchronization_unittest.cc
+++ b/webrtc/video/stream_synchronization_unittest.cc
@@ -36,16 +36,17 @@ class Time {
RtcpMeasurement GenerateRtcp(int frequency, uint32_t offset) const {
RtcpMeasurement rtcp;
- NowNtp(&rtcp.ntp_secs, &rtcp.ntp_frac);
+ NowNtp(&rtcp.ntp_time);
rtcp.rtp_timestamp = NowRtp(frequency, offset);
return rtcp;
}
- void NowNtp(uint32_t* ntp_secs, uint32_t* ntp_frac) const {
- *ntp_secs = time_now_ms_ / 1000 + kNtpJan1970;
+ void NowNtp(NtpTime* ntp_time) const {
stefan-webrtc 2016/11/13 13:24:59 Change to NtpTime GetNowNtp() const?
åsapersson 2016/11/14 16:44:40 Done.
+ uint32_t ntp_secs = time_now_ms_ / 1000 + kNtpJan1970;
int64_t remainder_ms = time_now_ms_ % 1000;
- *ntp_frac = static_cast<uint32_t>(
+ uint32_t ntp_frac = static_cast<uint32_t>(
static_cast<double>(remainder_ms) * kNtpFracPerMs + 0.5);
+ ntp_time->Set(ntp_secs, ntp_frac);
}
uint32_t NowRtp(int frequency, uint32_t offset) const {
@@ -105,23 +106,28 @@ class StreamSynchronizationTest : public ::testing::Test {
// Generate NTP/RTP timestamp pair for both streams corresponding to RTCP.
RtcpMeasurement rtcp =
send_time_->GenerateRtcp(audio_frequency, audio_offset);
- EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_secs, rtcp.ntp_frac, rtcp.rtp_timestamp,
+ EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_time.seconds(),
+ rtcp.ntp_time.fractions(), rtcp.rtp_timestamp,
&audio.rtcp, &new_sr));
send_time_->IncreaseTimeMs(100);
receive_time_->IncreaseTimeMs(100);
rtcp = send_time_->GenerateRtcp(video_frequency, video_offset);
- EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_secs, rtcp.ntp_frac, rtcp.rtp_timestamp,
+ EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_time.seconds(),
+ rtcp.ntp_time.fractions(), rtcp.rtp_timestamp,
&video.rtcp, &new_sr));
send_time_->IncreaseTimeMs(900);
receive_time_->IncreaseTimeMs(900);
rtcp = send_time_->GenerateRtcp(audio_frequency, audio_offset);
- EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_secs, rtcp.ntp_frac, rtcp.rtp_timestamp,
+ EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_time.seconds(),
+ rtcp.ntp_time.fractions(), rtcp.rtp_timestamp,
&audio.rtcp, &new_sr));
send_time_->IncreaseTimeMs(100);
receive_time_->IncreaseTimeMs(100);
rtcp = send_time_->GenerateRtcp(video_frequency, video_offset);
- EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_secs, rtcp.ntp_frac, rtcp.rtp_timestamp,
+ EXPECT_TRUE(UpdateRtcpList(rtcp.ntp_time.seconds(),
+ rtcp.ntp_time.fractions(), rtcp.rtp_timestamp,
&video.rtcp, &new_sr));
+
send_time_->IncreaseTimeMs(900);
receive_time_->IncreaseTimeMs(900);
« no previous file with comments | « webrtc/video/rtp_streams_synchronizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698