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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/test/simple_test_tick_clock.h" | 10 #include "base/test/simple_test_tick_clock.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 *out_status = in_status; | 32 *out_status = in_status; |
33 } | 33 } |
34 | 34 |
35 } // namespace | 35 } // namespace |
36 | 36 |
37 class TestPacketSender : public PacketSender { | 37 class TestPacketSender : public PacketSender { |
38 public: | 38 public: |
39 TestPacketSender() : number_of_rtp_packets_(0), number_of_rtcp_packets_(0) {} | 39 TestPacketSender() : number_of_rtp_packets_(0), number_of_rtcp_packets_(0) {} |
40 | 40 |
41 bool SendPacket(PacketRef packet, const base::Closure& cb) final { | 41 bool SendPacket(PacketRef packet, const base::Closure& cb) final { |
42 if (Rtcp::IsRtcpPacket(&packet->data[0], packet->data.size())) { | 42 if (IsRtcpPacket(&packet->data[0], packet->data.size())) { |
43 ++number_of_rtcp_packets_; | 43 ++number_of_rtcp_packets_; |
44 } else { | 44 } else { |
45 // Check that at least one RTCP packet was sent before the first RTP | 45 // Check that at least one RTCP packet was sent before the first RTP |
46 // packet. This confirms that the receiver will have the necessary lip | 46 // packet. This confirms that the receiver will have the necessary lip |
47 // sync info before it has to calculate the playout time of the first | 47 // sync info before it has to calculate the playout time of the first |
48 // frame. | 48 // frame. |
49 if (number_of_rtp_packets_ == 0) | 49 if (number_of_rtp_packets_ == 0) |
50 EXPECT_LE(1, number_of_rtcp_packets_); | 50 EXPECT_LE(1, number_of_rtcp_packets_); |
51 ++number_of_rtp_packets_; | 51 ++number_of_rtp_packets_; |
52 } | 52 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 base::TimeDelta max_rtcp_timeout = | 153 base::TimeDelta max_rtcp_timeout = |
154 base::TimeDelta::FromMilliseconds(1 + kRtcpReportIntervalMs * 3 / 2); | 154 base::TimeDelta::FromMilliseconds(1 + kRtcpReportIntervalMs * 3 / 2); |
155 testing_clock_->Advance(max_rtcp_timeout); | 155 testing_clock_->Advance(max_rtcp_timeout); |
156 task_runner_->RunTasks(); | 156 task_runner_->RunTasks(); |
157 EXPECT_LE(1, transport_.number_of_rtp_packets()); | 157 EXPECT_LE(1, transport_.number_of_rtp_packets()); |
158 EXPECT_LE(1, transport_.number_of_rtcp_packets()); | 158 EXPECT_LE(1, transport_.number_of_rtcp_packets()); |
159 } | 159 } |
160 | 160 |
161 } // namespace cast | 161 } // namespace cast |
162 } // namespace media | 162 } // namespace media |
OLD | NEW |