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

Unified Diff: webrtc/video/stream_synchronization_unittest.cc

Issue 2435053004: Use NtpTime in RtcpMeasurement instead of uint sec/uint frac. (Closed)
Patch Set: address comment 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..770bbf6eebd56aced50f89d394bea406c8718cb1 100644
--- a/webrtc/video/stream_synchronization_unittest.cc
+++ b/webrtc/video/stream_synchronization_unittest.cc
@@ -36,19 +36,20 @@ class Time {
RtcpMeasurement GenerateRtcp(int frequency, uint32_t offset) const {
RtcpMeasurement rtcp;
- NowNtp(&rtcp.ntp_secs, &rtcp.ntp_frac);
- rtcp.rtp_timestamp = NowRtp(frequency, offset);
+ rtcp.ntp_time = GetNowNtp();
+ rtcp.rtp_timestamp = GetNowRtp(frequency, offset);
return rtcp;
}
- void NowNtp(uint32_t* ntp_secs, uint32_t* ntp_frac) const {
- *ntp_secs = time_now_ms_ / 1000 + kNtpJan1970;
+ NtpTime GetNowNtp() const {
+ 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);
+ return NtpTime(ntp_secs, ntp_frac);
}
- uint32_t NowRtp(int frequency, uint32_t offset) const {
+ uint32_t GetNowRtp(int frequency, uint32_t offset) const {
return frequency * time_now_ms_ / 1000 + offset;
}
@@ -105,31 +106,36 @@ 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);
// Capture an audio and a video frame at the same time.
- audio.latest_timestamp = send_time_->NowRtp(audio_frequency,
- audio_offset);
- video.latest_timestamp = send_time_->NowRtp(video_frequency,
- video_offset);
+ audio.latest_timestamp =
+ send_time_->GetNowRtp(audio_frequency, audio_offset);
+ video.latest_timestamp =
+ send_time_->GetNowRtp(video_frequency, video_offset);
if (audio_delay_ms > video_delay_ms) {
// Audio later than video.
« 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