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