| 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 "base/test/simple_test_tick_clock.h" | 5 #include "base/test/simple_test_tick_clock.h" |
| 6 #include "media/cast/cast_defines.h" | 6 #include "media/cast/cast_defines.h" |
| 7 #include "media/cast/cast_environment.h" | 7 #include "media/cast/cast_environment.h" |
| 8 #include "media/cast/net/pacing/paced_sender.h" | |
| 9 #include "media/cast/rtcp/mock_rtcp_receiver_feedback.h" | 8 #include "media/cast/rtcp/mock_rtcp_receiver_feedback.h" |
| 10 #include "media/cast/rtcp/mock_rtcp_sender_feedback.h" | 9 #include "media/cast/rtcp/mock_rtcp_sender_feedback.h" |
| 11 #include "media/cast/rtcp/rtcp.h" | 10 #include "media/cast/rtcp/rtcp.h" |
| 12 #include "media/cast/rtcp/test_rtcp_packet_builder.h" | 11 #include "media/cast/rtcp/test_rtcp_packet_builder.h" |
| 13 #include "media/cast/test/fake_task_runner.h" | 12 #include "media/cast/test/fake_task_runner.h" |
| 13 #include "media/cast/transport/pacing/paced_sender.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 namespace cast { | 17 namespace cast { |
| 18 | 18 |
| 19 using testing::_; | 19 using testing::_; |
| 20 | 20 |
| 21 static const uint32 kSenderSsrc = 0x10203; | 21 static const uint32 kSenderSsrc = 0x10203; |
| 22 static const uint32 kReceiverSsrc = 0x40506; | 22 static const uint32 kReceiverSsrc = 0x40506; |
| 23 static const std::string kCName("test@10.1.1.1"); | 23 static const std::string kCName("test@10.1.1.1"); |
| 24 static const uint32 kRtcpIntervalMs = 500; | 24 static const uint32 kRtcpIntervalMs = 500; |
| 25 static const int64 kStartMillisecond = GG_INT64_C(12345678900000); | 25 static const int64 kStartMillisecond = GG_INT64_C(12345678900000); |
| 26 static const int64 kAddedDelay = 123; | 26 static const int64 kAddedDelay = 123; |
| 27 static const int64 kAddedShortDelay= 100; | 27 static const int64 kAddedShortDelay= 100; |
| 28 | 28 |
| 29 class LocalRtcpTransport : public PacedPacketSender { | 29 class LocalRtcpTransport : public transport::PacedPacketSender { |
| 30 public: | 30 public: |
| 31 explicit LocalRtcpTransport(scoped_refptr<CastEnvironment> cast_environment, | 31 explicit LocalRtcpTransport(scoped_refptr<CastEnvironment> cast_environment, |
| 32 base::SimpleTestTickClock* testing_clock) | 32 base::SimpleTestTickClock* testing_clock) |
| 33 : drop_packets_(false), | 33 : drop_packets_(false), |
| 34 short_delay_(false), | 34 short_delay_(false), |
| 35 testing_clock_(testing_clock) {} | 35 testing_clock_(testing_clock) {} |
| 36 | 36 |
| 37 void SetRtcpReceiver(Rtcp* rtcp) { rtcp_ = rtcp; } | 37 void SetRtcpReceiver(Rtcp* rtcp) { rtcp_ = rtcp; } |
| 38 | 38 |
| 39 void SetShortDelay() { short_delay_ = true; } | 39 void SetShortDelay() { short_delay_ = true; } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 67 bool short_delay_; | 67 bool short_delay_; |
| 68 Rtcp* rtcp_; | 68 Rtcp* rtcp_; |
| 69 base::SimpleTestTickClock* testing_clock_; | 69 base::SimpleTestTickClock* testing_clock_; |
| 70 scoped_refptr<CastEnvironment> cast_environment_; | 70 scoped_refptr<CastEnvironment> cast_environment_; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 class RtcpPeer : public Rtcp { | 73 class RtcpPeer : public Rtcp { |
| 74 public: | 74 public: |
| 75 RtcpPeer(scoped_refptr<CastEnvironment> cast_environment, | 75 RtcpPeer(scoped_refptr<CastEnvironment> cast_environment, |
| 76 RtcpSenderFeedback* sender_feedback, | 76 RtcpSenderFeedback* sender_feedback, |
| 77 PacedPacketSender* const paced_packet_sender, | 77 transport::PacedPacketSender* const paced_packet_sender, |
| 78 RtpSenderStatistics* rtp_sender_statistics, | 78 RtpSenderStatistics* rtp_sender_statistics, |
| 79 RtpReceiverStatistics* rtp_receiver_statistics, | 79 RtpReceiverStatistics* rtp_receiver_statistics, |
| 80 RtcpMode rtcp_mode, | 80 RtcpMode rtcp_mode, |
| 81 const base::TimeDelta& rtcp_interval, | 81 const base::TimeDelta& rtcp_interval, |
| 82 uint32 local_ssrc, | 82 uint32 local_ssrc, |
| 83 uint32 remote_ssrc, | 83 uint32 remote_ssrc, |
| 84 const std::string& c_name) | 84 const std::string& c_name) |
| 85 : Rtcp(cast_environment, | 85 : Rtcp(cast_environment, |
| 86 sender_feedback, | 86 sender_feedback, |
| 87 paced_packet_sender, | 87 paced_packet_sender, |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 rtcp_peer.OnReceivedLipSyncInfo(rtp_timestamp, ntp_seconds, ntp_fractions); | 532 rtcp_peer.OnReceivedLipSyncInfo(rtp_timestamp, ntp_seconds, ntp_fractions); |
| 533 rtp_timestamp = 64000; | 533 rtp_timestamp = 64000; |
| 534 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(frequency, rtp_timestamp, | 534 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(frequency, rtp_timestamp, |
| 535 &rtp_timestamp_in_ticks)); | 535 &rtp_timestamp_in_ticks)); |
| 536 EXPECT_EQ(input_time + base::TimeDelta::FromMilliseconds(4000), | 536 EXPECT_EQ(input_time + base::TimeDelta::FromMilliseconds(4000), |
| 537 rtp_timestamp_in_ticks); | 537 rtp_timestamp_in_ticks); |
| 538 } | 538 } |
| 539 | 539 |
| 540 } // namespace cast | 540 } // namespace cast |
| 541 } // namespace media | 541 } // namespace media |
| OLD | NEW |