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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc

Issue 2733823002: Replace Clock::CurrentNtp with Clock::CurrentNtpTime (Closed)
Patch Set: Remove CurrentNtp instead of deprecate Created 3 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 28 matching lines...) Expand all
39 remote_clock_.AdvanceTimeMilliseconds(ms); 39 remote_clock_.AdvanceTimeMilliseconds(ms);
40 } 40 }
41 41
42 uint32_t GetRemoteTimestamp() { 42 uint32_t GetRemoteTimestamp() {
43 return static_cast<uint32_t>(remote_clock_.TimeInMilliseconds()) * 90 + 43 return static_cast<uint32_t>(remote_clock_.TimeInMilliseconds()) * 90 +
44 kTimestampOffset; 44 kTimestampOffset;
45 } 45 }
46 46
47 void SendRtcpSr() { 47 void SendRtcpSr() {
48 uint32_t rtcp_timestamp = GetRemoteTimestamp(); 48 uint32_t rtcp_timestamp = GetRemoteTimestamp();
49 uint32_t ntp_seconds; 49 NtpTime ntp = remote_clock_.CurrentNtpTime();
50 uint32_t ntp_fractions;
51 remote_clock_.CurrentNtp(ntp_seconds, ntp_fractions);
52 50
53 AdvanceTimeMilliseconds(kTestRtt / 2); 51 AdvanceTimeMilliseconds(kTestRtt / 2);
54 ReceiveRtcpSr(kTestRtt, rtcp_timestamp, ntp_seconds, ntp_fractions); 52 ReceiveRtcpSr(kTestRtt, rtcp_timestamp, ntp.seconds(), ntp.fractions());
55 } 53 }
56 54
57 void UpdateRtcpTimestamp(int64_t rtt, uint32_t ntp_secs, uint32_t ntp_frac, 55 void UpdateRtcpTimestamp(int64_t rtt, uint32_t ntp_secs, uint32_t ntp_frac,
58 uint32_t rtp_timestamp, bool expected_result) { 56 uint32_t rtp_timestamp, bool expected_result) {
59 EXPECT_EQ(expected_result, 57 EXPECT_EQ(expected_result,
60 estimator_.UpdateRtcpTimestamp(rtt, ntp_secs, ntp_frac, 58 estimator_.UpdateRtcpTimestamp(rtt, ntp_secs, ntp_frac,
61 rtp_timestamp)); 59 rtp_timestamp));
62 } 60 }
63 61
64 void ReceiveRtcpSr(int64_t rtt, 62 void ReceiveRtcpSr(int64_t rtt,
(...skipping 27 matching lines...) Expand all
92 90
93 AdvanceTimeMilliseconds(800); 91 AdvanceTimeMilliseconds(800);
94 // Remote sends second RTCP SR. 92 // Remote sends second RTCP SR.
95 SendRtcpSr(); 93 SendRtcpSr();
96 94
97 // Local peer gets enough RTCP SR to calculate the capture time. 95 // Local peer gets enough RTCP SR to calculate the capture time.
98 EXPECT_EQ(capture_ntp_time_ms, estimator_.Estimate(rtp_timestamp)); 96 EXPECT_EQ(capture_ntp_time_ms, estimator_.Estimate(rtp_timestamp));
99 } 97 }
100 98
101 } // namespace webrtc 99 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698