| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/test/simple_test_tick_clock.h" | 9 #include "base/test/simple_test_tick_clock.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_); | 84 task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_); |
| 85 cast_environment_ = | 85 cast_environment_ = |
| 86 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_).Pass(), | 86 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_).Pass(), |
| 87 task_runner_, | 87 task_runner_, |
| 88 task_runner_, | 88 task_runner_, |
| 89 task_runner_, | 89 task_runner_, |
| 90 task_runner_, | 90 task_runner_, |
| 91 task_runner_, | 91 task_runner_, |
| 92 task_runner_, | 92 task_runner_, |
| 93 GetDefaultCastSenderLoggingConfig()); | 93 GetDefaultCastSenderLoggingConfig()); |
| 94 transport::CastTransportConfig transport_config; | 94 transport::CastTransportVideoConfig transport_config; |
| 95 net::IPEndPoint dummy_endpoint; |
| 95 transport_sender_.reset(new transport::CastTransportSenderImpl( | 96 transport_sender_.reset(new transport::CastTransportSenderImpl( |
| 96 testing_clock_, | 97 testing_clock_, |
| 97 transport_config, | 98 dummy_endpoint, |
| 99 dummy_endpoint, |
| 98 base::Bind(&UpdateCastTransportStatus), | 100 base::Bind(&UpdateCastTransportStatus), |
| 99 task_runner_, | 101 task_runner_, |
| 100 &transport_)); | 102 &transport_)); |
| 103 transport_sender_->InitializeVideo(transport_config); |
| 101 } | 104 } |
| 102 | 105 |
| 103 virtual ~VideoSenderTest() {} | 106 virtual ~VideoSenderTest() {} |
| 104 | 107 |
| 105 virtual void TearDown() OVERRIDE { | 108 virtual void TearDown() OVERRIDE { |
| 106 video_sender_.reset(); | 109 video_sender_.reset(); |
| 107 task_runner_->RunTasks(); | 110 task_runner_->RunTasks(); |
| 108 } | 111 } |
| 109 | 112 |
| 110 static void UpdateCastTransportStatus(transport::CastTransportStatus status) { | 113 static void UpdateCastTransportStatus(transport::CastTransportStatus status) { |
| 111 EXPECT_EQ(status, transport::TRANSPORT_INITIALIZED); | 114 EXPECT_EQ(status, transport::TRANSPORT_VIDEO_INITIALIZED); |
| 112 } | 115 } |
| 113 | 116 |
| 114 void InitEncoder(bool external) { | 117 void InitEncoder(bool external) { |
| 115 VideoSenderConfig video_config; | 118 VideoSenderConfig video_config; |
| 116 video_config.sender_ssrc = 1; | 119 video_config.sender_ssrc = 1; |
| 117 video_config.incoming_feedback_ssrc = 2; | 120 video_config.incoming_feedback_ssrc = 2; |
| 118 video_config.rtcp_c_name = "video_test@10.1.1.1"; | 121 video_config.rtcp_c_name = "video_test@10.1.1.1"; |
| 119 video_config.rtp_config.payload_type = 127; | 122 video_config.rtp_config.payload_type = 127; |
| 120 video_config.use_external_encoder = external; | 123 video_config.use_external_encoder = external; |
| 121 video_config.width = kWidth; | 124 video_config.width = kWidth; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // Make sure that we do a re-send. | 251 // Make sure that we do a re-send. |
| 249 RunTasks(max_resend_timeout.InMilliseconds()); | 252 RunTasks(max_resend_timeout.InMilliseconds()); |
| 250 // Should have sent at least 3 packets. | 253 // Should have sent at least 3 packets. |
| 251 EXPECT_GE( | 254 EXPECT_GE( |
| 252 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), | 255 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), |
| 253 3); | 256 3); |
| 254 } | 257 } |
| 255 | 258 |
| 256 } // namespace cast | 259 } // namespace cast |
| 257 } // namespace media | 260 } // namespace media |
| OLD | NEW |