| 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> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 VideoSenderTest() { | 102 VideoSenderTest() { |
| 103 testing_clock_ = new base::SimpleTestTickClock(); | 103 testing_clock_ = new base::SimpleTestTickClock(); |
| 104 testing_clock_->Advance( | 104 testing_clock_->Advance( |
| 105 base::TimeDelta::FromMilliseconds(kStartMillisecond)); | 105 base::TimeDelta::FromMilliseconds(kStartMillisecond)); |
| 106 task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_); | 106 task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_); |
| 107 cast_environment_ = | 107 cast_environment_ = |
| 108 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_).Pass(), | 108 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_).Pass(), |
| 109 task_runner_, | 109 task_runner_, |
| 110 task_runner_, | 110 task_runner_, |
| 111 task_runner_); | 111 task_runner_); |
| 112 transport::CastTransportVideoConfig transport_config; | |
| 113 net::IPEndPoint dummy_endpoint; | 112 net::IPEndPoint dummy_endpoint; |
| 114 transport_sender_.reset(new transport::CastTransportSenderImpl( | 113 transport_sender_.reset(new transport::CastTransportSenderImpl( |
| 115 NULL, | 114 NULL, |
| 116 testing_clock_, | 115 testing_clock_, |
| 117 dummy_endpoint, | 116 dummy_endpoint, |
| 118 base::Bind(&UpdateCastTransportStatus), | 117 base::Bind(&UpdateCastTransportStatus), |
| 119 transport::BulkRawEventsCallback(), | 118 transport::BulkRawEventsCallback(), |
| 120 base::TimeDelta(), | 119 base::TimeDelta(), |
| 121 task_runner_, | 120 task_runner_, |
| 122 &transport_)); | 121 &transport_)); |
| 123 transport_sender_->InitializeVideo(transport_config); | |
| 124 } | 122 } |
| 125 | 123 |
| 126 virtual ~VideoSenderTest() {} | 124 virtual ~VideoSenderTest() {} |
| 127 | 125 |
| 128 virtual void TearDown() OVERRIDE { | 126 virtual void TearDown() OVERRIDE { |
| 129 video_sender_.reset(); | 127 video_sender_.reset(); |
| 130 task_runner_->RunTasks(); | 128 task_runner_->RunTasks(); |
| 131 } | 129 } |
| 132 | 130 |
| 133 static void UpdateCastTransportStatus(transport::CastTransportStatus status) { | 131 static void UpdateCastTransportStatus(transport::CastTransportStatus status) { |
| 134 EXPECT_EQ(status, transport::TRANSPORT_VIDEO_INITIALIZED); | 132 EXPECT_EQ(status, transport::TRANSPORT_VIDEO_INITIALIZED); |
| 135 } | 133 } |
| 136 | 134 |
| 137 void InitEncoder(bool external) { | 135 void InitEncoder(bool external) { |
| 138 VideoSenderConfig video_config; | 136 VideoSenderConfig video_config; |
| 139 video_config.sender_ssrc = 1; | 137 video_config.rtp_config.ssrc = 1; |
| 140 video_config.incoming_feedback_ssrc = 2; | 138 video_config.incoming_feedback_ssrc = 2; |
| 141 video_config.rtcp_c_name = "video_test@10.1.1.1"; | 139 video_config.rtcp_c_name = "video_test@10.1.1.1"; |
| 142 video_config.rtp_config.payload_type = 127; | 140 video_config.rtp_config.payload_type = 127; |
| 143 video_config.use_external_encoder = external; | 141 video_config.use_external_encoder = external; |
| 144 video_config.width = kWidth; | 142 video_config.width = kWidth; |
| 145 video_config.height = kHeight; | 143 video_config.height = kHeight; |
| 146 video_config.max_bitrate = 5000000; | 144 video_config.max_bitrate = 5000000; |
| 147 video_config.min_bitrate = 1000000; | 145 video_config.min_bitrate = 1000000; |
| 148 video_config.start_bitrate = 1000000; | 146 video_config.start_bitrate = 1000000; |
| 149 video_config.max_qp = 56; | 147 video_config.max_qp = 56; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // Empty the pipeline. | 362 // Empty the pipeline. |
| 365 RunTasks(100); | 363 RunTasks(100); |
| 366 // Should have sent at least 7 packets. | 364 // Should have sent at least 7 packets. |
| 367 EXPECT_GE( | 365 EXPECT_GE( |
| 368 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), | 366 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), |
| 369 7); | 367 7); |
| 370 } | 368 } |
| 371 | 369 |
| 372 } // namespace cast | 370 } // namespace cast |
| 373 } // namespace media | 371 } // namespace media |
| OLD | NEW |