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> |
| 6 |
5 #include "base/bind.h" | 7 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
7 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
8 #include "base/test/simple_test_tick_clock.h" | 10 #include "base/test/simple_test_tick_clock.h" |
9 #include "media/base/media.h" | 11 #include "media/base/media.h" |
10 #include "media/cast/audio_sender/audio_sender.h" | 12 #include "media/cast/audio_sender/audio_sender.h" |
11 #include "media/cast/cast_config.h" | 13 #include "media/cast/cast_config.h" |
12 #include "media/cast/cast_environment.h" | 14 #include "media/cast/cast_environment.h" |
13 #include "media/cast/rtcp/rtcp.h" | 15 #include "media/cast/rtcp/rtcp.h" |
14 #include "media/cast/test/fake_single_thread_task_runner.h" | 16 #include "media/cast/test/fake_single_thread_task_runner.h" |
15 #include "media/cast/test/utility/audio_utility.h" | 17 #include "media/cast/test/utility/audio_utility.h" |
16 #include "media/cast/transport/cast_transport_config.h" | 18 #include "media/cast/transport/cast_transport_config.h" |
17 #include "media/cast/transport/cast_transport_sender_impl.h" | 19 #include "media/cast/transport/cast_transport_sender_impl.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
19 | 21 |
20 namespace media { | 22 namespace media { |
21 namespace cast { | 23 namespace cast { |
22 | 24 |
23 static const int64 kStartMillisecond = GG_INT64_C(12345678900000); | 25 static const int64 kStartMillisecond = INT64_C(12345678900000); |
24 | 26 |
25 class TestPacketSender : public transport::PacketSender { | 27 class TestPacketSender : public transport::PacketSender { |
26 public: | 28 public: |
27 TestPacketSender() : number_of_rtp_packets_(0), number_of_rtcp_packets_(0) {} | 29 TestPacketSender() : number_of_rtp_packets_(0), number_of_rtcp_packets_(0) {} |
28 | 30 |
29 virtual bool SendPacket(const Packet& packet) OVERRIDE { | 31 virtual bool SendPacket(const Packet& packet) OVERRIDE { |
30 if (Rtcp::IsRtcpPacket(&packet[0], packet.size())) { | 32 if (Rtcp::IsRtcpPacket(&packet[0], packet.size())) { |
31 ++number_of_rtcp_packets_; | 33 ++number_of_rtcp_packets_; |
32 } else { | 34 } else { |
33 ++number_of_rtp_packets_; | 35 ++number_of_rtp_packets_; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 base::TimeDelta max_rtcp_timeout = | 135 base::TimeDelta max_rtcp_timeout = |
134 base::TimeDelta::FromMilliseconds(1 + kDefaultRtcpIntervalMs * 3 / 2); | 136 base::TimeDelta::FromMilliseconds(1 + kDefaultRtcpIntervalMs * 3 / 2); |
135 testing_clock_->Advance(max_rtcp_timeout); | 137 testing_clock_->Advance(max_rtcp_timeout); |
136 task_runner_->RunTasks(); | 138 task_runner_->RunTasks(); |
137 EXPECT_GE(transport_.number_of_rtp_packets(), 1); | 139 EXPECT_GE(transport_.number_of_rtp_packets(), 1); |
138 EXPECT_EQ(transport_.number_of_rtcp_packets(), 1); | 140 EXPECT_EQ(transport_.number_of_rtcp_packets(), 1); |
139 } | 141 } |
140 | 142 |
141 } // namespace cast | 143 } // namespace cast |
142 } // namespace media | 144 } // namespace media |
OLD | NEW |