OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/test/simple_test_tick_clock.h" | 7 #include "base/test/simple_test_tick_clock.h" |
8 #include "media/cast/cast_defines.h" | 8 #include "media/cast/cast_defines.h" |
9 #include "media/cast/net/cast_transport_config.h" | 9 #include "media/cast/net/cast_transport_config.h" |
10 #include "media/cast/net/pacing/paced_sender.h" | 10 #include "media/cast/net/pacing/paced_sender.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 public: | 25 public: |
26 explicit FakeRtcpTransport(base::SimpleTestTickClock* clock) | 26 explicit FakeRtcpTransport(base::SimpleTestTickClock* clock) |
27 : clock_(clock), | 27 : clock_(clock), |
28 packet_delay_(base::TimeDelta::FromMilliseconds(42)) {} | 28 packet_delay_(base::TimeDelta::FromMilliseconds(42)) {} |
29 | 29 |
30 void set_rtcp_destination(Rtcp* rtcp) { rtcp_ = rtcp; } | 30 void set_rtcp_destination(Rtcp* rtcp) { rtcp_ = rtcp; } |
31 | 31 |
32 base::TimeDelta packet_delay() const { return packet_delay_; } | 32 base::TimeDelta packet_delay() const { return packet_delay_; } |
33 void set_packet_delay(base::TimeDelta delay) { packet_delay_ = delay; } | 33 void set_packet_delay(base::TimeDelta delay) { packet_delay_ = delay; } |
34 | 34 |
35 virtual bool SendRtcpPacket(uint32 ssrc, PacketRef packet) OVERRIDE { | 35 virtual bool SendRtcpPacket(uint32 ssrc, PacketRef packet) override { |
36 clock_->Advance(packet_delay_); | 36 clock_->Advance(packet_delay_); |
37 rtcp_->IncomingRtcpPacket(&packet->data[0], packet->data.size()); | 37 rtcp_->IncomingRtcpPacket(&packet->data[0], packet->data.size()); |
38 return true; | 38 return true; |
39 } | 39 } |
40 | 40 |
41 virtual bool SendPackets(const SendPacketVector& packets) OVERRIDE { | 41 virtual bool SendPackets(const SendPacketVector& packets) override { |
42 return false; | 42 return false; |
43 } | 43 } |
44 | 44 |
45 virtual bool ResendPackets( | 45 virtual bool ResendPackets( |
46 const SendPacketVector& packets, const DedupInfo& dedup_info) OVERRIDE { | 46 const SendPacketVector& packets, const DedupInfo& dedup_info) override { |
47 return false; | 47 return false; |
48 } | 48 } |
49 | 49 |
50 virtual void CancelSendingPacket(const PacketKey& packet_key) OVERRIDE { | 50 virtual void CancelSendingPacket(const PacketKey& packet_key) override { |
51 } | 51 } |
52 | 52 |
53 private: | 53 private: |
54 base::SimpleTestTickClock* const clock_; | 54 base::SimpleTestTickClock* const clock_; |
55 base::TimeDelta packet_delay_; | 55 base::TimeDelta packet_delay_; |
56 Rtcp* rtcp_; | 56 Rtcp* rtcp_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(FakeRtcpTransport); | 58 DISALLOW_COPY_AND_ASSIGN(FakeRtcpTransport); |
59 }; | 59 }; |
60 | 60 |
61 class FakeReceiverStats : public RtpReceiverStatistics { | 61 class FakeReceiverStats : public RtpReceiverStatistics { |
62 public: | 62 public: |
63 FakeReceiverStats() {} | 63 FakeReceiverStats() {} |
64 virtual ~FakeReceiverStats() {} | 64 virtual ~FakeReceiverStats() {} |
65 | 65 |
66 virtual void GetStatistics(uint8* fraction_lost, | 66 virtual void GetStatistics(uint8* fraction_lost, |
67 uint32* cumulative_lost, | 67 uint32* cumulative_lost, |
68 uint32* extended_high_sequence_number, | 68 uint32* extended_high_sequence_number, |
69 uint32* jitter) OVERRIDE { | 69 uint32* jitter) override { |
70 *fraction_lost = 0; | 70 *fraction_lost = 0; |
71 *cumulative_lost = 0; | 71 *cumulative_lost = 0; |
72 *extended_high_sequence_number = 0; | 72 *extended_high_sequence_number = 0; |
73 *jitter = 0; | 73 *jitter = 0; |
74 } | 74 } |
75 | 75 |
76 private: | 76 private: |
77 DISALLOW_COPY_AND_ASSIGN(FakeReceiverStats); | 77 DISALLOW_COPY_AND_ASSIGN(FakeReceiverStats); |
78 }; | 78 }; |
79 | 79 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 base::TimeTicks out_3 = ConvertNtpToTimeTicks(ntp_seconds_3, ntp_fraction_3); | 261 base::TimeTicks out_3 = ConvertNtpToTimeTicks(ntp_seconds_3, ntp_fraction_3); |
262 EXPECT_EQ(input_time, out_3); // Verify inverse. | 262 EXPECT_EQ(input_time, out_3); // Verify inverse. |
263 | 263 |
264 // Verify delta. | 264 // Verify delta. |
265 EXPECT_EQ((out_3 - out_2), time_delta); | 265 EXPECT_EQ((out_3 - out_2), time_delta); |
266 EXPECT_NEAR((ntp_fraction_3 - ntp_fraction_2), 0xffffffff / 2, 1); | 266 EXPECT_NEAR((ntp_fraction_3 - ntp_fraction_2), 0xffffffff / 2, 1); |
267 } | 267 } |
268 | 268 |
269 } // namespace cast | 269 } // namespace cast |
270 } // namespace media | 270 } // namespace media |
OLD | NEW |