Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(974)

Side by Side Diff: webrtc/test/call_test.cc

Issue 1273363005: Add send transports to individual webrtc::Call streams. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase+comment Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/test/call_test.h ('k') | webrtc/video/bitrate_estimator_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include "webrtc/test/call_test.h" 10 #include "webrtc/test/call_test.h"
11 #include "webrtc/test/encoder_settings.h" 11 #include "webrtc/test/encoder_settings.h"
12 12
13 namespace webrtc { 13 namespace webrtc {
14 namespace test { 14 namespace test {
15 15
16 namespace { 16 namespace {
17 const int kVideoRotationRtpExtensionId = 4; 17 const int kVideoRotationRtpExtensionId = 4;
18 } 18 }
19 19
20 CallTest::CallTest() 20 CallTest::CallTest()
21 : clock_(Clock::GetRealTimeClock()), 21 : clock_(Clock::GetRealTimeClock()),
22 send_config_(nullptr),
22 send_stream_(NULL), 23 send_stream_(NULL),
23 fake_encoder_(clock_) { 24 fake_encoder_(clock_) {
24 } 25 }
25 26
26 CallTest::~CallTest() { 27 CallTest::~CallTest() {
27 } 28 }
28 29
29 void CallTest::RunBaseTest(BaseTest* test) { 30 void CallTest::RunBaseTest(BaseTest* test) {
30 CreateSenderCall(test->GetSenderCallConfig()); 31 CreateSenderCall(test->GetSenderCallConfig());
31 if (test->ShouldCreateReceivers()) 32 if (test->ShouldCreateReceivers())
32 CreateReceiverCall(test->GetReceiverCallConfig()); 33 CreateReceiverCall(test->GetReceiverCallConfig());
33 test->OnCallsCreated(sender_call_.get(), receiver_call_.get()); 34 test->OnCallsCreated(sender_call_.get(), receiver_call_.get());
34 35
35 if (test->ShouldCreateReceivers()) { 36 if (test->ShouldCreateReceivers()) {
36 test->SetReceivers(receiver_call_->Receiver(), sender_call_->Receiver()); 37 test->SetReceivers(receiver_call_->Receiver(), sender_call_->Receiver());
37 } else { 38 } else {
38 // Sender-only call delivers to itself. 39 // Sender-only call delivers to itself.
39 test->SetReceivers(sender_call_->Receiver(), NULL); 40 test->SetReceivers(sender_call_->Receiver(), NULL);
40 } 41 }
41 42
42 CreateSendConfig(test->GetNumStreams()); 43 CreateSendConfig(test->GetNumStreams(), test->SendTransport());
43 if (test->ShouldCreateReceivers()) { 44 if (test->ShouldCreateReceivers()) {
44 CreateMatchingReceiveConfigs(); 45 CreateMatchingReceiveConfigs(test->ReceiveTransport());
45 } 46 }
46 test->ModifyConfigs(&send_config_, &receive_configs_, &encoder_config_); 47 test->ModifyConfigs(&send_config_, &receive_configs_, &encoder_config_);
47 CreateStreams(); 48 CreateStreams();
48 test->OnStreamsCreated(send_stream_, receive_streams_); 49 test->OnStreamsCreated(send_stream_, receive_streams_);
49 50
50 CreateFrameGeneratorCapturer(); 51 CreateFrameGeneratorCapturer();
51 test->OnFrameGeneratorCapturerCreated(frame_generator_capturer_.get()); 52 test->OnFrameGeneratorCapturerCreated(frame_generator_capturer_.get());
52 53
53 Start(); 54 Start();
54 test->PerformTest(); 55 test->PerformTest();
(...skipping 26 matching lines...) Expand all
81 } 82 }
82 83
83 void CallTest::CreateSenderCall(const Call::Config& config) { 84 void CallTest::CreateSenderCall(const Call::Config& config) {
84 sender_call_.reset(Call::Create(config)); 85 sender_call_.reset(Call::Create(config));
85 } 86 }
86 87
87 void CallTest::CreateReceiverCall(const Call::Config& config) { 88 void CallTest::CreateReceiverCall(const Call::Config& config) {
88 receiver_call_.reset(Call::Create(config)); 89 receiver_call_.reset(Call::Create(config));
89 } 90 }
90 91
91 void CallTest::CreateSendConfig(size_t num_streams) { 92 void CallTest::CreateSendConfig(size_t num_streams,
93 newapi::Transport* send_transport) {
92 assert(num_streams <= kNumSsrcs); 94 assert(num_streams <= kNumSsrcs);
93 send_config_ = VideoSendStream::Config(); 95 send_config_ = VideoSendStream::Config(send_transport);
94 send_config_.encoder_settings.encoder = &fake_encoder_; 96 send_config_.encoder_settings.encoder = &fake_encoder_;
95 send_config_.encoder_settings.payload_name = "FAKE"; 97 send_config_.encoder_settings.payload_name = "FAKE";
96 send_config_.encoder_settings.payload_type = kFakeSendPayloadType; 98 send_config_.encoder_settings.payload_type = kFakeSendPayloadType;
97 send_config_.rtp.extensions.push_back( 99 send_config_.rtp.extensions.push_back(
98 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); 100 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId));
99 encoder_config_.streams = test::CreateVideoStreams(num_streams); 101 encoder_config_.streams = test::CreateVideoStreams(num_streams);
100 for (size_t i = 0; i < num_streams; ++i) 102 for (size_t i = 0; i < num_streams; ++i)
101 send_config_.rtp.ssrcs.push_back(kSendSsrcs[i]); 103 send_config_.rtp.ssrcs.push_back(kSendSsrcs[i]);
102 send_config_.rtp.extensions.push_back( 104 send_config_.rtp.extensions.push_back(
103 RtpExtension(RtpExtension::kVideoRotation, kVideoRotationRtpExtensionId)); 105 RtpExtension(RtpExtension::kVideoRotation, kVideoRotationRtpExtensionId));
104 } 106 }
105 107
106 void CallTest::CreateMatchingReceiveConfigs() { 108 void CallTest::CreateMatchingReceiveConfigs(
109 newapi::Transport* rtcp_send_transport) {
107 assert(!send_config_.rtp.ssrcs.empty()); 110 assert(!send_config_.rtp.ssrcs.empty());
108 assert(receive_configs_.empty()); 111 assert(receive_configs_.empty());
109 assert(allocated_decoders_.empty()); 112 assert(allocated_decoders_.empty());
110 VideoReceiveStream::Config config; 113 VideoReceiveStream::Config config(rtcp_send_transport);
111 config.rtp.remb = true; 114 config.rtp.remb = true;
112 config.rtp.local_ssrc = kReceiverLocalSsrc; 115 config.rtp.local_ssrc = kReceiverLocalSsrc;
113 for (const RtpExtension& extension : send_config_.rtp.extensions) 116 for (const RtpExtension& extension : send_config_.rtp.extensions)
114 config.rtp.extensions.push_back(extension); 117 config.rtp.extensions.push_back(extension);
115 for (size_t i = 0; i < send_config_.rtp.ssrcs.size(); ++i) { 118 for (size_t i = 0; i < send_config_.rtp.ssrcs.size(); ++i) {
116 VideoReceiveStream::Decoder decoder = 119 VideoReceiveStream::Decoder decoder =
117 test::CreateMatchingDecoder(send_config_.encoder_settings); 120 test::CreateMatchingDecoder(send_config_.encoder_settings);
118 allocated_decoders_.push_back(decoder.decoder); 121 allocated_decoders_.push_back(decoder.decoder);
119 config.decoders.clear(); 122 config.decoders.clear();
120 config.decoders.push_back(decoder); 123 config.decoders.push_back(decoder);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 179
177 BaseTest::BaseTest(unsigned int timeout_ms, 180 BaseTest::BaseTest(unsigned int timeout_ms,
178 const FakeNetworkPipe::Config& config) 181 const FakeNetworkPipe::Config& config)
179 : RtpRtcpObserver(timeout_ms, config) { 182 : RtpRtcpObserver(timeout_ms, config) {
180 } 183 }
181 184
182 BaseTest::~BaseTest() { 185 BaseTest::~BaseTest() {
183 } 186 }
184 187
185 Call::Config BaseTest::GetSenderCallConfig() { 188 Call::Config BaseTest::GetSenderCallConfig() {
186 return Call::Config(SendTransport()); 189 return Call::Config();
187 } 190 }
188 191
189 Call::Config BaseTest::GetReceiverCallConfig() { 192 Call::Config BaseTest::GetReceiverCallConfig() {
190 return Call::Config(ReceiveTransport()); 193 return Call::Config();
191 } 194 }
192 195
193 void BaseTest::OnCallsCreated(Call* sender_call, Call* receiver_call) { 196 void BaseTest::OnCallsCreated(Call* sender_call, Call* receiver_call) {
194 } 197 }
195 198
196 size_t BaseTest::GetNumStreams() const { 199 size_t BaseTest::GetNumStreams() const {
197 return 1; 200 return 1;
198 } 201 }
199 202
200 void BaseTest::ModifyConfigs( 203 void BaseTest::ModifyConfigs(
(...skipping 30 matching lines...) Expand all
231 const FakeNetworkPipe::Config& config) 234 const FakeNetworkPipe::Config& config)
232 : BaseTest(timeout_ms, config) { 235 : BaseTest(timeout_ms, config) {
233 } 236 }
234 237
235 bool EndToEndTest::ShouldCreateReceivers() const { 238 bool EndToEndTest::ShouldCreateReceivers() const {
236 return true; 239 return true;
237 } 240 }
238 241
239 } // namespace test 242 } // namespace test
240 } // namespace webrtc 243 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/call_test.h ('k') | webrtc/video/bitrate_estimator_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698