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