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 <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/cast_environment.h" | 9 #include "media/cast/cast_environment.h" |
10 #include "media/cast/rtcp/mock_rtcp_receiver_feedback.h" | 10 #include "media/cast/rtcp/mock_rtcp_receiver_feedback.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 : drop_packets_(false), | 77 : drop_packets_(false), |
78 short_delay_(false), | 78 short_delay_(false), |
79 testing_clock_(testing_clock) {} | 79 testing_clock_(testing_clock) {} |
80 | 80 |
81 void set_rtcp_receiver(Rtcp* rtcp) { rtcp_ = rtcp; } | 81 void set_rtcp_receiver(Rtcp* rtcp) { rtcp_ = rtcp; } |
82 | 82 |
83 void set_short_delay() { short_delay_ = true; } | 83 void set_short_delay() { short_delay_ = true; } |
84 | 84 |
85 void set_drop_packets(bool drop_packets) { drop_packets_ = drop_packets; } | 85 void set_drop_packets(bool drop_packets) { drop_packets_ = drop_packets; } |
86 | 86 |
87 virtual bool SendRtcpPacket(transport::PacketRef packet) OVERRIDE { | 87 virtual bool SendRtcpPacket(uint32 ssrc, |
| 88 transport::PacketRef packet) OVERRIDE { |
88 if (short_delay_) { | 89 if (short_delay_) { |
89 testing_clock_->Advance( | 90 testing_clock_->Advance( |
90 base::TimeDelta::FromMilliseconds(kAddedShortDelay)); | 91 base::TimeDelta::FromMilliseconds(kAddedShortDelay)); |
91 } else { | 92 } else { |
92 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(kAddedDelay)); | 93 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(kAddedDelay)); |
93 } | 94 } |
94 if (drop_packets_) | 95 if (drop_packets_) |
95 return true; | 96 return true; |
96 | 97 |
97 rtcp_->IncomingRtcpPacket(&packet->data[0], packet->data.size()); | 98 rtcp_->IncomingRtcpPacket(&packet->data[0], packet->data.size()); |
98 return true; | 99 return true; |
99 } | 100 } |
100 | 101 |
101 virtual bool SendPackets(const PacketList& packets) OVERRIDE { return false; } | 102 virtual bool SendPackets( |
102 | 103 const transport::SendPacketVector& packets) OVERRIDE { |
103 virtual bool ResendPackets(const PacketList& packets) OVERRIDE { | |
104 return false; | 104 return false; |
105 } | 105 } |
106 | 106 |
| 107 virtual bool ResendPackets( |
| 108 const transport::SendPacketVector& packets) OVERRIDE { |
| 109 return false; |
| 110 } |
| 111 |
107 private: | 112 private: |
108 bool drop_packets_; | 113 bool drop_packets_; |
109 bool short_delay_; | 114 bool short_delay_; |
110 Rtcp* rtcp_; | 115 Rtcp* rtcp_; |
111 base::SimpleTestTickClock* testing_clock_; | 116 base::SimpleTestTickClock* testing_clock_; |
112 scoped_refptr<CastEnvironment> cast_environment_; | 117 scoped_refptr<CastEnvironment> cast_environment_; |
113 | 118 |
114 DISALLOW_COPY_AND_ASSIGN(LocalRtcpTransport); | 119 DISALLOW_COPY_AND_ASSIGN(LocalRtcpTransport); |
115 }; | 120 }; |
116 | 121 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 rtcp_peer.OnReceivedLipSyncInfo(rtp_timestamp, ntp_seconds, ntp_fractions); | 626 rtcp_peer.OnReceivedLipSyncInfo(rtp_timestamp, ntp_seconds, ntp_fractions); |
622 rtp_timestamp = 64000; | 627 rtp_timestamp = 64000; |
623 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime( | 628 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime( |
624 frequency, rtp_timestamp, &rtp_timestamp_in_ticks)); | 629 frequency, rtp_timestamp, &rtp_timestamp_in_ticks)); |
625 EXPECT_EQ(input_time + base::TimeDelta::FromMilliseconds(4000), | 630 EXPECT_EQ(input_time + base::TimeDelta::FromMilliseconds(4000), |
626 rtp_timestamp_in_ticks); | 631 rtp_timestamp_in_ticks); |
627 } | 632 } |
628 | 633 |
629 } // namespace cast | 634 } // namespace cast |
630 } // namespace media | 635 } // namespace media |
OLD | NEW |