OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
6 | 6 |
7 #include "base/test/simple_test_tick_clock.h" | 7 #include "base/test/simple_test_tick_clock.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "media/cast/rtp_common/rtp_defines.h" | 9 #include "media/cast/rtp_common/rtp_defines.h" |
10 #include "media/cast/rtp_receiver/receiver_stats.h" | 10 #include "media/cast/rtp_receiver/receiver_stats.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 rtp_header_(), | 23 rtp_header_(), |
24 fraction_lost_(0), | 24 fraction_lost_(0), |
25 cumulative_lost_(0), | 25 cumulative_lost_(0), |
26 extended_high_sequence_number_(0), | 26 extended_high_sequence_number_(0), |
27 jitter_(0) { | 27 jitter_(0) { |
28 testing_clock_.Advance( | 28 testing_clock_.Advance( |
29 base::TimeDelta::FromMilliseconds(kStartMillisecond)); | 29 base::TimeDelta::FromMilliseconds(kStartMillisecond)); |
30 start_time_ = testing_clock_.NowTicks(); | 30 start_time_ = testing_clock_.NowTicks(); |
31 delta_increments_ = base::TimeDelta::FromMilliseconds(kStdTimeIncrementMs); | 31 delta_increments_ = base::TimeDelta::FromMilliseconds(kStdTimeIncrementMs); |
32 } | 32 } |
33 ~ReceiverStatsTest() {} | 33 virtual ~ReceiverStatsTest() {} |
34 | 34 |
35 virtual void SetUp() { | 35 virtual void SetUp() { |
36 rtp_header_.webrtc.header.sequenceNumber = 0; | 36 rtp_header_.webrtc.header.sequenceNumber = 0; |
37 rtp_header_.webrtc.header.timestamp = 0; | 37 rtp_header_.webrtc.header.timestamp = 0; |
38 rtp_header_.webrtc.header.ssrc = kSsrc; | 38 rtp_header_.webrtc.header.ssrc = kSsrc; |
39 } | 39 } |
40 | 40 |
41 uint32 ExpectedJitter(uint32 const_interval, int num_packets) { | 41 uint32 ExpectedJitter(uint32 const_interval, int num_packets) { |
42 float jitter = 0; | 42 float jitter = 0; |
43 // Assume timestamps have a constant kStdTimeIncrementMs interval. | 43 // Assume timestamps have a constant kStdTimeIncrementMs interval. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 EXPECT_FALSE(fraction_lost_); | 148 EXPECT_FALSE(fraction_lost_); |
149 EXPECT_FALSE(cumulative_lost_); | 149 EXPECT_FALSE(cumulative_lost_); |
150 // Build extended sequence number (one wrap cycle). | 150 // Build extended sequence number (one wrap cycle). |
151 uint32 extended_seq_num = rtp_header_.webrtc.header.sequenceNumber - 1; | 151 uint32 extended_seq_num = rtp_header_.webrtc.header.sequenceNumber - 1; |
152 EXPECT_EQ(extended_seq_num, extended_high_sequence_number_); | 152 EXPECT_EQ(extended_seq_num, extended_high_sequence_number_); |
153 EXPECT_EQ(ExpectedJitter(kStdTimeIncrementMs, 300), jitter_); | 153 EXPECT_EQ(ExpectedJitter(kStdTimeIncrementMs, 300), jitter_); |
154 } | 154 } |
155 | 155 |
156 } // namespace cast | 156 } // namespace cast |
157 } // namespace media | 157 } // namespace media |
OLD | NEW |