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

Side by Side Diff: webrtc/video/end_to_end_tests.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/video/call_perf_tests.cc ('k') | webrtc/video/full_stack.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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 <algorithm> 10 #include <algorithm>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void ReceivesPliAndRecovers(int rtp_history_ms); 75 void ReceivesPliAndRecovers(int rtp_history_ms);
76 void RespectsRtcpMode(newapi::RtcpMode rtcp_mode); 76 void RespectsRtcpMode(newapi::RtcpMode rtcp_mode);
77 void TestXrReceiverReferenceTimeReport(bool enable_rrtr); 77 void TestXrReceiverReferenceTimeReport(bool enable_rrtr);
78 void TestSendsSetSsrcs(size_t num_ssrcs, bool send_single_ssrc_first); 78 void TestSendsSetSsrcs(size_t num_ssrcs, bool send_single_ssrc_first);
79 void TestRtpStatePreservation(bool use_rtx); 79 void TestRtpStatePreservation(bool use_rtx);
80 void TestReceivedFecPacketsNotNacked(const FakeNetworkPipe::Config& config); 80 void TestReceivedFecPacketsNotNacked(const FakeNetworkPipe::Config& config);
81 void VerifyHistogramStats(bool use_rtx, bool use_red); 81 void VerifyHistogramStats(bool use_rtx, bool use_red);
82 }; 82 };
83 83
84 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { 84 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) {
85 CreateCalls(Call::Config(), Call::Config());
86
85 test::NullTransport transport; 87 test::NullTransport transport;
86 CreateCalls(Call::Config(&transport), Call::Config(&transport)); 88 CreateSendConfig(1, &transport);
87 89 CreateMatchingReceiveConfigs(&transport);
88 CreateSendConfig(1);
89 CreateMatchingReceiveConfigs();
90 90
91 CreateStreams(); 91 CreateStreams();
92 92
93 receive_streams_[0]->Start(); 93 receive_streams_[0]->Start();
94 receive_streams_[0]->Start(); 94 receive_streams_[0]->Start();
95 95
96 DestroyStreams(); 96 DestroyStreams();
97 } 97 }
98 98
99 TEST_F(EndToEndTest, ReceiverCanBeStoppedTwice) { 99 TEST_F(EndToEndTest, ReceiverCanBeStoppedTwice) {
100 CreateCalls(Call::Config(), Call::Config());
101
100 test::NullTransport transport; 102 test::NullTransport transport;
101 CreateCalls(Call::Config(&transport), Call::Config(&transport)); 103 CreateSendConfig(1, &transport);
102 104 CreateMatchingReceiveConfigs(&transport);
103 CreateSendConfig(1);
104 CreateMatchingReceiveConfigs();
105 105
106 CreateStreams(); 106 CreateStreams();
107 107
108 receive_streams_[0]->Stop(); 108 receive_streams_[0]->Stop();
109 receive_streams_[0]->Stop(); 109 receive_streams_[0]->Stop();
110 110
111 DestroyStreams(); 111 DestroyStreams();
112 } 112 }
113 113
114 TEST_F(EndToEndTest, RendersSingleDelayedFrame) { 114 TEST_F(EndToEndTest, RendersSingleDelayedFrame) {
(...skipping 28 matching lines...) Expand all
143 143
144 private: 144 private:
145 void FrameCallback(VideoFrame* frame) override { 145 void FrameCallback(VideoFrame* frame) override {
146 SleepMs(kDelayRenderCallbackMs); 146 SleepMs(kDelayRenderCallbackMs);
147 event_->Set(); 147 event_->Set();
148 } 148 }
149 149
150 rtc::scoped_ptr<EventWrapper> event_; 150 rtc::scoped_ptr<EventWrapper> event_;
151 }; 151 };
152 152
153 CreateCalls(Call::Config(), Call::Config());
154
153 test::DirectTransport sender_transport, receiver_transport; 155 test::DirectTransport sender_transport, receiver_transport;
154
155 CreateCalls(Call::Config(&sender_transport),
156 Call::Config(&receiver_transport));
157
158 sender_transport.SetReceiver(receiver_call_->Receiver()); 156 sender_transport.SetReceiver(receiver_call_->Receiver());
159 receiver_transport.SetReceiver(sender_call_->Receiver()); 157 receiver_transport.SetReceiver(sender_call_->Receiver());
160 158
161 CreateSendConfig(1); 159 CreateSendConfig(1, &sender_transport);
162 CreateMatchingReceiveConfigs(); 160 CreateMatchingReceiveConfigs(&receiver_transport);
163 161
164 TestFrameCallback pre_render_callback; 162 TestFrameCallback pre_render_callback;
165 receive_configs_[0].pre_render_callback = &pre_render_callback; 163 receive_configs_[0].pre_render_callback = &pre_render_callback;
166 receive_configs_[0].renderer = &renderer; 164 receive_configs_[0].renderer = &renderer;
167 165
168 CreateStreams(); 166 CreateStreams();
169 Start(); 167 Start();
170 168
171 // Create frames that are smaller than the send width/height, this is done to 169 // Create frames that are smaller than the send width/height, this is done to
172 // check that the callbacks are done after processing video. 170 // check that the callbacks are done after processing video.
(...skipping 22 matching lines...) Expand all
195 int /*time_to_render_ms*/) override { 193 int /*time_to_render_ms*/) override {
196 event_->Set(); 194 event_->Set();
197 } 195 }
198 bool IsTextureSupported() const override { return false; } 196 bool IsTextureSupported() const override { return false; }
199 197
200 EventTypeWrapper Wait() { return event_->Wait(kDefaultTimeoutMs); } 198 EventTypeWrapper Wait() { return event_->Wait(kDefaultTimeoutMs); }
201 199
202 rtc::scoped_ptr<EventWrapper> event_; 200 rtc::scoped_ptr<EventWrapper> event_;
203 } renderer; 201 } renderer;
204 202
203 CreateCalls(Call::Config(), Call::Config());
204
205 test::DirectTransport sender_transport, receiver_transport; 205 test::DirectTransport sender_transport, receiver_transport;
206
207 CreateCalls(Call::Config(&sender_transport),
208 Call::Config(&receiver_transport));
209
210 sender_transport.SetReceiver(receiver_call_->Receiver()); 206 sender_transport.SetReceiver(receiver_call_->Receiver());
211 receiver_transport.SetReceiver(sender_call_->Receiver()); 207 receiver_transport.SetReceiver(sender_call_->Receiver());
212 208
213 CreateSendConfig(1); 209 CreateSendConfig(1, &sender_transport);
214 CreateMatchingReceiveConfigs(); 210 CreateMatchingReceiveConfigs(&receiver_transport);
215 receive_configs_[0].renderer = &renderer; 211 receive_configs_[0].renderer = &renderer;
216 212
217 CreateStreams(); 213 CreateStreams();
218 Start(); 214 Start();
219 215
220 rtc::scoped_ptr<test::FrameGenerator> frame_generator( 216 rtc::scoped_ptr<test::FrameGenerator> frame_generator(
221 test::FrameGenerator::CreateChromaGenerator( 217 test::FrameGenerator::CreateChromaGenerator(
222 encoder_config_.streams[0].width, encoder_config_.streams[0].height)); 218 encoder_config_.streams[0].width, encoder_config_.streams[0].height));
223 send_stream_->Input()->IncomingCapturedFrame(*frame_generator->NextFrame()); 219 send_stream_->Input()->IncomingCapturedFrame(*frame_generator->NextFrame());
224 220
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 nacks.begin(), nacks.end(), fec_sequence_number_) == nacks.end()); 630 nacks.begin(), nacks.end(), fec_sequence_number_) == nacks.end());
635 observation_complete_->Set(); 631 observation_complete_->Set();
636 } 632 }
637 } 633 }
638 return SEND_PACKET; 634 return SEND_PACKET;
639 } 635 }
640 636
641 // TODO(holmer): Investigate why we don't send FEC packets when the bitrate 637 // TODO(holmer): Investigate why we don't send FEC packets when the bitrate
642 // is 10 kbps. 638 // is 10 kbps.
643 Call::Config GetSenderCallConfig() override { 639 Call::Config GetSenderCallConfig() override {
644 Call::Config config(SendTransport()); 640 Call::Config config;
645 const int kMinBitrateBps = 30000; 641 const int kMinBitrateBps = 30000;
646 config.bitrate_config.min_bitrate_bps = kMinBitrateBps; 642 config.bitrate_config.min_bitrate_bps = kMinBitrateBps;
647 return config; 643 return config;
648 } 644 }
649 645
650 void ModifyConfigs(VideoSendStream::Config* send_config, 646 void ModifyConfigs(VideoSendStream::Config* send_config,
651 std::vector<VideoReceiveStream::Config>* receive_configs, 647 std::vector<VideoReceiveStream::Config>* receive_configs,
652 VideoEncoderConfig* encoder_config) override { 648 VideoEncoderConfig* encoder_config) override {
653 // Configure hybrid NACK/FEC. 649 // Configure hybrid NACK/FEC.
654 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 650 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 } 836 }
841 837
842 rtc::scoped_ptr<EventWrapper> event_; 838 rtc::scoped_ptr<EventWrapper> event_;
843 int expected_luma_byte_; 839 int expected_luma_byte_;
844 int next_luma_byte_; 840 int next_luma_byte_;
845 }; 841 };
846 842
847 TestFrameCallback pre_encode_callback(-1, 255); // Changes luma to 255. 843 TestFrameCallback pre_encode_callback(-1, 255); // Changes luma to 255.
848 TestFrameCallback pre_render_callback(255, 0); // Changes luma from 255 to 0. 844 TestFrameCallback pre_render_callback(255, 0); // Changes luma from 255 to 0.
849 845
846 CreateCalls(Call::Config(), Call::Config());
847
850 test::DirectTransport sender_transport, receiver_transport; 848 test::DirectTransport sender_transport, receiver_transport;
851
852 CreateCalls(Call::Config(&sender_transport),
853 Call::Config(&receiver_transport));
854
855 sender_transport.SetReceiver(receiver_call_->Receiver()); 849 sender_transport.SetReceiver(receiver_call_->Receiver());
856 receiver_transport.SetReceiver(sender_call_->Receiver()); 850 receiver_transport.SetReceiver(sender_call_->Receiver());
857 851
858 CreateSendConfig(1); 852 CreateSendConfig(1, &sender_transport);
859 rtc::scoped_ptr<VideoEncoder> encoder( 853 rtc::scoped_ptr<VideoEncoder> encoder(
860 VideoEncoder::Create(VideoEncoder::kVp8)); 854 VideoEncoder::Create(VideoEncoder::kVp8));
861 send_config_.encoder_settings.encoder = encoder.get(); 855 send_config_.encoder_settings.encoder = encoder.get();
862 send_config_.encoder_settings.payload_name = "VP8"; 856 send_config_.encoder_settings.payload_name = "VP8";
863 ASSERT_EQ(1u, encoder_config_.streams.size()) << "Test setup error."; 857 ASSERT_EQ(1u, encoder_config_.streams.size()) << "Test setup error.";
864 encoder_config_.streams[0].width = kWidth; 858 encoder_config_.streams[0].width = kWidth;
865 encoder_config_.streams[0].height = kHeight; 859 encoder_config_.streams[0].height = kHeight;
866 send_config_.pre_encode_callback = &pre_encode_callback; 860 send_config_.pre_encode_callback = &pre_encode_callback;
867 861
868 CreateMatchingReceiveConfigs(); 862 CreateMatchingReceiveConfigs(&receiver_transport);
869 receive_configs_[0].pre_render_callback = &pre_render_callback; 863 receive_configs_[0].pre_render_callback = &pre_render_callback;
870 receive_configs_[0].renderer = &renderer; 864 receive_configs_[0].renderer = &renderer;
871 865
872 CreateStreams(); 866 CreateStreams();
873 Start(); 867 Start();
874 868
875 // Create frames that are smaller than the send width/height, this is done to 869 // Create frames that are smaller than the send width/height, this is done to
876 // check that the callbacks are done after processing video. 870 // check that the callbacks are done after processing video.
877 rtc::scoped_ptr<test::FrameGenerator> frame_generator( 871 rtc::scoped_ptr<test::FrameGenerator> frame_generator(
878 test::FrameGenerator::CreateChromaGenerator(kWidth / 2, kHeight / 2)); 872 test::FrameGenerator::CreateChromaGenerator(kWidth / 2, kHeight / 2));
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 EXPECT_EQ(DELIVERY_UNKNOWN_SSRC, delivery_status); 1003 EXPECT_EQ(DELIVERY_UNKNOWN_SSRC, delivery_status);
1010 delivered_packet_->Set(); 1004 delivered_packet_->Set();
1011 return delivery_status; 1005 return delivery_status;
1012 } 1006 }
1013 } 1007 }
1014 1008
1015 PacketReceiver* receiver_; 1009 PacketReceiver* receiver_;
1016 rtc::scoped_ptr<EventWrapper> delivered_packet_; 1010 rtc::scoped_ptr<EventWrapper> delivered_packet_;
1017 }; 1011 };
1018 1012
1013 CreateCalls(Call::Config(), Call::Config());
1014
1019 test::DirectTransport send_transport, receive_transport; 1015 test::DirectTransport send_transport, receive_transport;
1020
1021 CreateCalls(Call::Config(&send_transport), Call::Config(&receive_transport));
1022 PacketInputObserver input_observer(receiver_call_->Receiver()); 1016 PacketInputObserver input_observer(receiver_call_->Receiver());
1023
1024 send_transport.SetReceiver(&input_observer); 1017 send_transport.SetReceiver(&input_observer);
1025 receive_transport.SetReceiver(sender_call_->Receiver()); 1018 receive_transport.SetReceiver(sender_call_->Receiver());
1026 1019
1027 CreateSendConfig(1); 1020 CreateSendConfig(1, &send_transport);
1028 CreateMatchingReceiveConfigs(); 1021 CreateMatchingReceiveConfigs(&receive_transport);
1029 1022
1030 CreateStreams(); 1023 CreateStreams();
1031 CreateFrameGeneratorCapturer(); 1024 CreateFrameGeneratorCapturer();
1032 Start(); 1025 Start();
1033 1026
1034 receiver_call_->DestroyVideoReceiveStream(receive_streams_[0]); 1027 receiver_call_->DestroyVideoReceiveStream(receive_streams_[0]);
1035 receive_streams_.clear(); 1028 receive_streams_.clear();
1036 1029
1037 // Wait() waits for a received packet. 1030 // Wait() waits for a received packet.
1038 EXPECT_EQ(kEventSignaled, input_observer.Wait()); 1031 EXPECT_EQ(kEventSignaled, input_observer.Wait());
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 } 1143 }
1151 1144
1152 virtual ~MultiStreamTest() {} 1145 virtual ~MultiStreamTest() {}
1153 1146
1154 void RunTest() { 1147 void RunTest() {
1155 rtc::scoped_ptr<test::DirectTransport> sender_transport( 1148 rtc::scoped_ptr<test::DirectTransport> sender_transport(
1156 CreateSendTransport()); 1149 CreateSendTransport());
1157 rtc::scoped_ptr<test::DirectTransport> receiver_transport( 1150 rtc::scoped_ptr<test::DirectTransport> receiver_transport(
1158 CreateReceiveTransport()); 1151 CreateReceiveTransport());
1159 1152
1160 rtc::scoped_ptr<Call> sender_call( 1153 rtc::scoped_ptr<Call> sender_call(Call::Create(Call::Config()));
1161 Call::Create(Call::Config(sender_transport.get()))); 1154 rtc::scoped_ptr<Call> receiver_call(Call::Create(Call::Config()));
1162 rtc::scoped_ptr<Call> receiver_call(
1163 Call::Create(Call::Config(receiver_transport.get())));
1164 sender_transport->SetReceiver(receiver_call->Receiver()); 1155 sender_transport->SetReceiver(receiver_call->Receiver());
1165 receiver_transport->SetReceiver(sender_call->Receiver()); 1156 receiver_transport->SetReceiver(sender_call->Receiver());
1166 1157
1167 rtc::scoped_ptr<VideoEncoder> encoders[kNumStreams]; 1158 rtc::scoped_ptr<VideoEncoder> encoders[kNumStreams];
1168 for (size_t i = 0; i < kNumStreams; ++i) 1159 for (size_t i = 0; i < kNumStreams; ++i)
1169 encoders[i].reset(VideoEncoder::Create(VideoEncoder::kVp8)); 1160 encoders[i].reset(VideoEncoder::Create(VideoEncoder::kVp8));
1170 1161
1171 VideoSendStream* send_streams[kNumStreams]; 1162 VideoSendStream* send_streams[kNumStreams];
1172 VideoReceiveStream* receive_streams[kNumStreams]; 1163 VideoReceiveStream* receive_streams[kNumStreams];
1173 1164
1174 test::FrameGeneratorCapturer* frame_generators[kNumStreams]; 1165 test::FrameGeneratorCapturer* frame_generators[kNumStreams];
1175 ScopedVector<VideoDecoder> allocated_decoders; 1166 ScopedVector<VideoDecoder> allocated_decoders;
1176 for (size_t i = 0; i < kNumStreams; ++i) { 1167 for (size_t i = 0; i < kNumStreams; ++i) {
1177 uint32_t ssrc = codec_settings[i].ssrc; 1168 uint32_t ssrc = codec_settings[i].ssrc;
1178 int width = codec_settings[i].width; 1169 int width = codec_settings[i].width;
1179 int height = codec_settings[i].height; 1170 int height = codec_settings[i].height;
1180 1171
1181 VideoSendStream::Config send_config; 1172 VideoSendStream::Config send_config(sender_transport.get());
1182 send_config.rtp.ssrcs.push_back(ssrc); 1173 send_config.rtp.ssrcs.push_back(ssrc);
1183 send_config.encoder_settings.encoder = encoders[i].get(); 1174 send_config.encoder_settings.encoder = encoders[i].get();
1184 send_config.encoder_settings.payload_name = "VP8"; 1175 send_config.encoder_settings.payload_name = "VP8";
1185 send_config.encoder_settings.payload_type = 124; 1176 send_config.encoder_settings.payload_type = 124;
1186 VideoEncoderConfig encoder_config; 1177 VideoEncoderConfig encoder_config;
1187 encoder_config.streams = test::CreateVideoStreams(1); 1178 encoder_config.streams = test::CreateVideoStreams(1);
1188 VideoStream* stream = &encoder_config.streams[0]; 1179 VideoStream* stream = &encoder_config.streams[0];
1189 stream->width = width; 1180 stream->width = width;
1190 stream->height = height; 1181 stream->height = height;
1191 stream->max_framerate = 5; 1182 stream->max_framerate = 5;
1192 stream->min_bitrate_bps = stream->target_bitrate_bps = 1183 stream->min_bitrate_bps = stream->target_bitrate_bps =
1193 stream->max_bitrate_bps = 100000; 1184 stream->max_bitrate_bps = 100000;
1194 1185
1195 UpdateSendConfig(i, &send_config, &encoder_config, &frame_generators[i]); 1186 UpdateSendConfig(i, &send_config, &encoder_config, &frame_generators[i]);
1196 1187
1197 send_streams[i] = 1188 send_streams[i] =
1198 sender_call->CreateVideoSendStream(send_config, encoder_config); 1189 sender_call->CreateVideoSendStream(send_config, encoder_config);
1199 send_streams[i]->Start(); 1190 send_streams[i]->Start();
1200 1191
1201 VideoReceiveStream::Config receive_config; 1192 VideoReceiveStream::Config receive_config(receiver_transport.get());
1202 receive_config.rtp.remote_ssrc = ssrc; 1193 receive_config.rtp.remote_ssrc = ssrc;
1203 receive_config.rtp.local_ssrc = test::CallTest::kReceiverLocalSsrc; 1194 receive_config.rtp.local_ssrc = test::CallTest::kReceiverLocalSsrc;
1204 VideoReceiveStream::Decoder decoder = 1195 VideoReceiveStream::Decoder decoder =
1205 test::CreateMatchingDecoder(send_config.encoder_settings); 1196 test::CreateMatchingDecoder(send_config.encoder_settings);
1206 allocated_decoders.push_back(decoder.decoder); 1197 allocated_decoders.push_back(decoder.decoder);
1207 receive_config.decoders.push_back(decoder); 1198 receive_config.decoders.push_back(decoder);
1208 1199
1209 UpdateReceiveConfig(i, &receive_config); 1200 UpdateReceiveConfig(i, &receive_config);
1210 1201
1211 receive_streams[i] = 1202 receive_streams[i] =
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 private: 1461 private:
1471 rtc::scoped_ptr<uint8_t[]> buffer_; 1462 rtc::scoped_ptr<uint8_t[]> buffer_;
1472 size_t length_; 1463 size_t length_;
1473 FrameType frame_type_; 1464 FrameType frame_type_;
1474 rtc::scoped_ptr<EventWrapper> called_; 1465 rtc::scoped_ptr<EventWrapper> called_;
1475 }; 1466 };
1476 1467
1477 EncodedFrameTestObserver post_encode_observer; 1468 EncodedFrameTestObserver post_encode_observer;
1478 EncodedFrameTestObserver pre_decode_observer; 1469 EncodedFrameTestObserver pre_decode_observer;
1479 1470
1471 CreateCalls(Call::Config(), Call::Config());
1472
1480 test::DirectTransport sender_transport, receiver_transport; 1473 test::DirectTransport sender_transport, receiver_transport;
1481
1482 CreateCalls(Call::Config(&sender_transport),
1483 Call::Config(&receiver_transport));
1484
1485 sender_transport.SetReceiver(receiver_call_->Receiver()); 1474 sender_transport.SetReceiver(receiver_call_->Receiver());
1486 receiver_transport.SetReceiver(sender_call_->Receiver()); 1475 receiver_transport.SetReceiver(sender_call_->Receiver());
1487 1476
1488 CreateSendConfig(1); 1477 CreateSendConfig(1, &sender_transport);
1489 CreateMatchingReceiveConfigs(); 1478 CreateMatchingReceiveConfigs(&receiver_transport);
1490 send_config_.post_encode_callback = &post_encode_observer; 1479 send_config_.post_encode_callback = &post_encode_observer;
1491 receive_configs_[0].pre_decode_callback = &pre_decode_observer; 1480 receive_configs_[0].pre_decode_callback = &pre_decode_observer;
1492 1481
1493 CreateStreams(); 1482 CreateStreams();
1494 Start(); 1483 Start();
1495 1484
1496 rtc::scoped_ptr<test::FrameGenerator> frame_generator( 1485 rtc::scoped_ptr<test::FrameGenerator> frame_generator(
1497 test::FrameGenerator::CreateChromaGenerator( 1486 test::FrameGenerator::CreateChromaGenerator(
1498 encoder_config_.streams[0].width, encoder_config_.streams[0].height)); 1487 encoder_config_.streams[0].width, encoder_config_.streams[0].height));
1499 send_stream_->Input()->IncomingCapturedFrame(*frame_generator->NextFrame()); 1488 send_stream_->Input()->IncomingCapturedFrame(*frame_generator->NextFrame());
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 2600
2612 std::map<uint32_t, uint16_t> last_observed_sequence_number_; 2601 std::map<uint32_t, uint16_t> last_observed_sequence_number_;
2613 std::map<uint32_t, uint32_t> last_observed_timestamp_; 2602 std::map<uint32_t, uint32_t> last_observed_timestamp_;
2614 std::map<uint32_t, bool> configured_ssrcs_; 2603 std::map<uint32_t, bool> configured_ssrcs_;
2615 2604
2616 rtc::CriticalSection crit_; 2605 rtc::CriticalSection crit_;
2617 size_t ssrcs_to_observe_ GUARDED_BY(crit_); 2606 size_t ssrcs_to_observe_ GUARDED_BY(crit_);
2618 std::map<uint32_t, bool> ssrc_observed_ GUARDED_BY(crit_); 2607 std::map<uint32_t, bool> ssrc_observed_ GUARDED_BY(crit_);
2619 } observer(use_rtx); 2608 } observer(use_rtx);
2620 2609
2621 CreateCalls(Call::Config(observer.SendTransport()), 2610 CreateCalls(Call::Config(), Call::Config());
2622 Call::Config(observer.ReceiveTransport()));
2623 observer.SetReceivers(sender_call_->Receiver(), nullptr); 2611 observer.SetReceivers(sender_call_->Receiver(), nullptr);
2624 2612
2625 CreateSendConfig(kNumSsrcs); 2613 CreateSendConfig(kNumSsrcs, observer.SendTransport());
2626 2614
2627 if (use_rtx) { 2615 if (use_rtx) {
2628 for (size_t i = 0; i < kNumSsrcs; ++i) { 2616 for (size_t i = 0; i < kNumSsrcs; ++i) {
2629 send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]); 2617 send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]);
2630 } 2618 }
2631 send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; 2619 send_config_.rtp.rtx.payload_type = kSendRtxPayloadType;
2632 } 2620 }
2633 2621
2634 // Lower bitrates so that all streams send initially. 2622 // Lower bitrates so that all streams send initially.
2635 for (size_t i = 0; i < encoder_config_.streams.size(); ++i) { 2623 for (size_t i = 0; i < encoder_config_.streams.size(); ++i) {
2636 encoder_config_.streams[i].min_bitrate_bps = 10000; 2624 encoder_config_.streams[i].min_bitrate_bps = 10000;
2637 encoder_config_.streams[i].target_bitrate_bps = 15000; 2625 encoder_config_.streams[i].target_bitrate_bps = 15000;
2638 encoder_config_.streams[i].max_bitrate_bps = 20000; 2626 encoder_config_.streams[i].max_bitrate_bps = 20000;
2639 } 2627 }
2640 2628
2641 // Use the same total bitrates when sending a single stream to avoid lowering 2629 // Use the same total bitrates when sending a single stream to avoid lowering
2642 // the bitrate estimate and requiring a subsequent rampup. 2630 // the bitrate estimate and requiring a subsequent rampup.
2643 VideoEncoderConfig one_stream = encoder_config_; 2631 VideoEncoderConfig one_stream = encoder_config_;
2644 one_stream.streams.resize(1); 2632 one_stream.streams.resize(1);
2645 for (size_t i = 1; i < encoder_config_.streams.size(); ++i) { 2633 for (size_t i = 1; i < encoder_config_.streams.size(); ++i) {
2646 one_stream.streams.front().min_bitrate_bps += 2634 one_stream.streams.front().min_bitrate_bps +=
2647 encoder_config_.streams[i].min_bitrate_bps; 2635 encoder_config_.streams[i].min_bitrate_bps;
2648 one_stream.streams.front().target_bitrate_bps += 2636 one_stream.streams.front().target_bitrate_bps +=
2649 encoder_config_.streams[i].target_bitrate_bps; 2637 encoder_config_.streams[i].target_bitrate_bps;
2650 one_stream.streams.front().max_bitrate_bps += 2638 one_stream.streams.front().max_bitrate_bps +=
2651 encoder_config_.streams[i].max_bitrate_bps; 2639 encoder_config_.streams[i].max_bitrate_bps;
2652 } 2640 }
2653 2641
2654 CreateMatchingReceiveConfigs(); 2642 CreateMatchingReceiveConfigs(observer.ReceiveTransport());
2655 2643
2656 CreateStreams(); 2644 CreateStreams();
2657 CreateFrameGeneratorCapturer(); 2645 CreateFrameGeneratorCapturer();
2658 2646
2659 Start(); 2647 Start();
2660 EXPECT_EQ(kEventSignaled, observer.Wait()) 2648 EXPECT_EQ(kEventSignaled, observer.Wait())
2661 << "Timed out waiting for all SSRCs to send packets."; 2649 << "Timed out waiting for all SSRCs to send packets.";
2662 2650
2663 // Test stream resetting more than once to make sure that the state doesn't 2651 // Test stream resetting more than once to make sure that the state doesn't
2664 // get set once (this could be due to using std::map::insert for instance). 2652 // get set once (this could be due to using std::map::insert for instance).
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2882 int down_frames_ GUARDED_BY(test_crit_); 2870 int down_frames_ GUARDED_BY(test_crit_);
2883 } test; 2871 } test;
2884 2872
2885 RunBaseTest(&test); 2873 RunBaseTest(&test);
2886 } 2874 }
2887 2875
2888 TEST_F(EndToEndTest, CallReportsRttForSender) { 2876 TEST_F(EndToEndTest, CallReportsRttForSender) {
2889 static const int kSendDelayMs = 30; 2877 static const int kSendDelayMs = 30;
2890 static const int kReceiveDelayMs = 70; 2878 static const int kReceiveDelayMs = 70;
2891 2879
2880 CreateCalls(Call::Config(), Call::Config());
2881
2892 FakeNetworkPipe::Config config; 2882 FakeNetworkPipe::Config config;
2893 config.queue_delay_ms = kSendDelayMs; 2883 config.queue_delay_ms = kSendDelayMs;
2894 test::DirectTransport sender_transport(config); 2884 test::DirectTransport sender_transport(config);
2895 config.queue_delay_ms = kReceiveDelayMs; 2885 config.queue_delay_ms = kReceiveDelayMs;
2896 test::DirectTransport receiver_transport(config); 2886 test::DirectTransport receiver_transport(config);
2897
2898 CreateCalls(Call::Config(&sender_transport),
2899 Call::Config(&receiver_transport));
2900
2901 sender_transport.SetReceiver(receiver_call_->Receiver()); 2887 sender_transport.SetReceiver(receiver_call_->Receiver());
2902 receiver_transport.SetReceiver(sender_call_->Receiver()); 2888 receiver_transport.SetReceiver(sender_call_->Receiver());
2903 2889
2904 CreateSendConfig(1); 2890 CreateSendConfig(1, &sender_transport);
2905 CreateMatchingReceiveConfigs(); 2891 CreateMatchingReceiveConfigs(&receiver_transport);
2906 2892
2907 CreateStreams(); 2893 CreateStreams();
2908 CreateFrameGeneratorCapturer(); 2894 CreateFrameGeneratorCapturer();
2909 Start(); 2895 Start();
2910 2896
2911 int64_t start_time_ms = clock_->TimeInMilliseconds(); 2897 int64_t start_time_ms = clock_->TimeInMilliseconds();
2912 while (true) { 2898 while (true) {
2913 Call::Stats stats = sender_call_->GetStats(); 2899 Call::Stats stats = sender_call_->GetStats();
2914 ASSERT_GE(start_time_ms + kDefaultTimeoutMs, 2900 ASSERT_GE(start_time_ms + kDefaultTimeoutMs,
2915 clock_->TimeInMilliseconds()) 2901 clock_->TimeInMilliseconds())
(...skipping 15 matching lines...) Expand all
2931 UnusedEncoder() : FakeEncoder(Clock::GetRealTimeClock()) {} 2917 UnusedEncoder() : FakeEncoder(Clock::GetRealTimeClock()) {}
2932 int32_t Encode(const VideoFrame& input_image, 2918 int32_t Encode(const VideoFrame& input_image,
2933 const CodecSpecificInfo* codec_specific_info, 2919 const CodecSpecificInfo* codec_specific_info,
2934 const std::vector<VideoFrameType>* frame_types) override { 2920 const std::vector<VideoFrameType>* frame_types) override {
2935 ADD_FAILURE() << "Unexpected frame encode."; 2921 ADD_FAILURE() << "Unexpected frame encode.";
2936 return test::FakeEncoder::Encode( 2922 return test::FakeEncoder::Encode(
2937 input_image, codec_specific_info, frame_types); 2923 input_image, codec_specific_info, frame_types);
2938 } 2924 }
2939 }; 2925 };
2940 2926
2941 UnusedTransport transport; 2927 CreateSenderCall(Call::Config());
2942 CreateSenderCall(Call::Config(&transport));
2943 sender_call_->SignalNetworkState(kNetworkDown); 2928 sender_call_->SignalNetworkState(kNetworkDown);
2944 2929
2945 CreateSendConfig(1); 2930 UnusedTransport transport;
2931 CreateSendConfig(1, &transport);
2946 UnusedEncoder unused_encoder; 2932 UnusedEncoder unused_encoder;
2947 send_config_.encoder_settings.encoder = &unused_encoder; 2933 send_config_.encoder_settings.encoder = &unused_encoder;
2948 CreateStreams(); 2934 CreateStreams();
2949 CreateFrameGeneratorCapturer(); 2935 CreateFrameGeneratorCapturer();
2950 2936
2951 Start(); 2937 Start();
2952 SleepMs(kSilenceTimeoutMs); 2938 SleepMs(kSilenceTimeoutMs);
2953 Stop(); 2939 Stop();
2954 2940
2955 DestroyStreams(); 2941 DestroyStreams();
2956 } 2942 }
2957 2943
2958 TEST_F(EndToEndTest, NewReceiveStreamsRespectNetworkDown) { 2944 TEST_F(EndToEndTest, NewReceiveStreamsRespectNetworkDown) {
2959 test::DirectTransport sender_transport; 2945 CreateCalls(Call::Config(), Call::Config());
2960 CreateSenderCall(Call::Config(&sender_transport));
2961 UnusedTransport transport;
2962 CreateReceiverCall(Call::Config(&transport));
2963 sender_transport.SetReceiver(receiver_call_->Receiver());
2964
2965 receiver_call_->SignalNetworkState(kNetworkDown); 2946 receiver_call_->SignalNetworkState(kNetworkDown);
2966 2947
2967 CreateSendConfig(1); 2948 test::DirectTransport sender_transport;
2968 CreateMatchingReceiveConfigs(); 2949 sender_transport.SetReceiver(receiver_call_->Receiver());
2950 CreateSendConfig(1, &sender_transport);
2951 UnusedTransport transport;
2952 CreateMatchingReceiveConfigs(&transport);
2969 CreateStreams(); 2953 CreateStreams();
2970 CreateFrameGeneratorCapturer(); 2954 CreateFrameGeneratorCapturer();
2971 2955
2972 Start(); 2956 Start();
2973 SleepMs(kSilenceTimeoutMs); 2957 SleepMs(kSilenceTimeoutMs);
2974 Stop(); 2958 Stop();
2975 2959
2976 sender_transport.StopSending(); 2960 sender_transport.StopSending();
2977 2961
2978 DestroyStreams(); 2962 DestroyStreams();
2979 } 2963 }
2980 2964
2981 // TODO(pbos): Remove this regression test when VideoEngine is no longer used as 2965 // TODO(pbos): Remove this regression test when VideoEngine is no longer used as
2982 // a backend. This is to test that we hand channels back properly. 2966 // a backend. This is to test that we hand channels back properly.
2983 TEST_F(EndToEndTest, CanCreateAndDestroyManyVideoStreams) { 2967 TEST_F(EndToEndTest, CanCreateAndDestroyManyVideoStreams) {
2984 test::NullTransport transport; 2968 test::NullTransport transport;
2985 rtc::scoped_ptr<Call> call(Call::Create(Call::Config(&transport))); 2969 rtc::scoped_ptr<Call> call(Call::Create(Call::Config()));
2986 test::FakeDecoder fake_decoder; 2970 test::FakeDecoder fake_decoder;
2987 test::FakeEncoder fake_encoder(Clock::GetRealTimeClock()); 2971 test::FakeEncoder fake_encoder(Clock::GetRealTimeClock());
2988 for (size_t i = 0; i < 100; ++i) { 2972 for (size_t i = 0; i < 100; ++i) {
2989 VideoSendStream::Config send_config; 2973 VideoSendStream::Config send_config(&transport);
2990 send_config.encoder_settings.encoder = &fake_encoder; 2974 send_config.encoder_settings.encoder = &fake_encoder;
2991 send_config.encoder_settings.payload_name = "FAKE"; 2975 send_config.encoder_settings.payload_name = "FAKE";
2992 send_config.encoder_settings.payload_type = 123; 2976 send_config.encoder_settings.payload_type = 123;
2993 2977
2994 VideoEncoderConfig encoder_config; 2978 VideoEncoderConfig encoder_config;
2995 encoder_config.streams = test::CreateVideoStreams(1); 2979 encoder_config.streams = test::CreateVideoStreams(1);
2996 send_config.rtp.ssrcs.push_back(1); 2980 send_config.rtp.ssrcs.push_back(1);
2997 VideoSendStream* send_stream = 2981 VideoSendStream* send_stream =
2998 call->CreateVideoSendStream(send_config, encoder_config); 2982 call->CreateVideoSendStream(send_config, encoder_config);
2999 call->DestroyVideoSendStream(send_stream); 2983 call->DestroyVideoSendStream(send_stream);
3000 2984
3001 VideoReceiveStream::Config receive_config; 2985 VideoReceiveStream::Config receive_config(&transport);
3002 receive_config.rtp.remote_ssrc = 1; 2986 receive_config.rtp.remote_ssrc = 1;
3003 receive_config.rtp.local_ssrc = kReceiverLocalSsrc; 2987 receive_config.rtp.local_ssrc = kReceiverLocalSsrc;
3004 VideoReceiveStream::Decoder decoder; 2988 VideoReceiveStream::Decoder decoder;
3005 decoder.decoder = &fake_decoder; 2989 decoder.decoder = &fake_decoder;
3006 decoder.payload_type = 123; 2990 decoder.payload_type = 123;
3007 decoder.payload_name = "FAKE"; 2991 decoder.payload_name = "FAKE";
3008 receive_config.decoders.push_back(decoder); 2992 receive_config.decoders.push_back(decoder);
3009 VideoReceiveStream* receive_stream = 2993 VideoReceiveStream* receive_stream =
3010 call->CreateVideoReceiveStream(receive_config); 2994 call->CreateVideoReceiveStream(receive_config);
3011 call->DestroyVideoReceiveStream(receive_stream); 2995 call->DestroyVideoReceiveStream(receive_stream);
3012 } 2996 }
3013 } 2997 }
3014 2998
3015 void VerifyEmptyNackConfig(const NackConfig& config) { 2999 void VerifyEmptyNackConfig(const NackConfig& config) {
3016 EXPECT_EQ(0, config.rtp_history_ms) 3000 EXPECT_EQ(0, config.rtp_history_ms)
3017 << "Enabling NACK requires rtcp-fb: nack negotiation."; 3001 << "Enabling NACK requires rtcp-fb: nack negotiation.";
3018 } 3002 }
3019 3003
3020 void VerifyEmptyFecConfig(const FecConfig& config) { 3004 void VerifyEmptyFecConfig(const FecConfig& config) {
3021 EXPECT_EQ(-1, config.ulpfec_payload_type) 3005 EXPECT_EQ(-1, config.ulpfec_payload_type)
3022 << "Enabling FEC requires rtpmap: ulpfec negotiation."; 3006 << "Enabling FEC requires rtpmap: ulpfec negotiation.";
3023 EXPECT_EQ(-1, config.red_payload_type) 3007 EXPECT_EQ(-1, config.red_payload_type)
3024 << "Enabling FEC requires rtpmap: red negotiation."; 3008 << "Enabling FEC requires rtpmap: red negotiation.";
3025 EXPECT_EQ(-1, config.red_rtx_payload_type) 3009 EXPECT_EQ(-1, config.red_rtx_payload_type)
3026 << "Enabling RTX in FEC requires rtpmap: rtx negotiation."; 3010 << "Enabling RTX in FEC requires rtpmap: rtx negotiation.";
3027 } 3011 }
3028 3012
3029 TEST_F(EndToEndTest, VerifyDefaultSendConfigParameters) { 3013 TEST_F(EndToEndTest, VerifyDefaultSendConfigParameters) {
3030 VideoSendStream::Config default_send_config; 3014 VideoSendStream::Config default_send_config(nullptr);
3031 EXPECT_EQ(0, default_send_config.rtp.nack.rtp_history_ms) 3015 EXPECT_EQ(0, default_send_config.rtp.nack.rtp_history_ms)
3032 << "Enabling NACK require rtcp-fb: nack negotiation."; 3016 << "Enabling NACK require rtcp-fb: nack negotiation.";
3033 EXPECT_TRUE(default_send_config.rtp.rtx.ssrcs.empty()) 3017 EXPECT_TRUE(default_send_config.rtp.rtx.ssrcs.empty())
3034 << "Enabling RTX requires rtpmap: rtx negotiation."; 3018 << "Enabling RTX requires rtpmap: rtx negotiation.";
3035 EXPECT_TRUE(default_send_config.rtp.extensions.empty()) 3019 EXPECT_TRUE(default_send_config.rtp.extensions.empty())
3036 << "Enabling RTP extensions require negotiation."; 3020 << "Enabling RTP extensions require negotiation.";
3037 3021
3038 VerifyEmptyNackConfig(default_send_config.rtp.nack); 3022 VerifyEmptyNackConfig(default_send_config.rtp.nack);
3039 VerifyEmptyFecConfig(default_send_config.rtp.fec); 3023 VerifyEmptyFecConfig(default_send_config.rtp.fec);
3040 } 3024 }
3041 3025
3042 TEST_F(EndToEndTest, VerifyDefaultReceiveConfigParameters) { 3026 TEST_F(EndToEndTest, VerifyDefaultReceiveConfigParameters) {
3043 VideoReceiveStream::Config default_receive_config; 3027 VideoReceiveStream::Config default_receive_config(nullptr);
3044 EXPECT_EQ(newapi::kRtcpCompound, default_receive_config.rtp.rtcp_mode) 3028 EXPECT_EQ(newapi::kRtcpCompound, default_receive_config.rtp.rtcp_mode)
3045 << "Reduced-size RTCP require rtcp-rsize to be negotiated."; 3029 << "Reduced-size RTCP require rtcp-rsize to be negotiated.";
3046 EXPECT_FALSE(default_receive_config.rtp.remb) 3030 EXPECT_FALSE(default_receive_config.rtp.remb)
3047 << "REMB require rtcp-fb: goog-remb to be negotiated."; 3031 << "REMB require rtcp-fb: goog-remb to be negotiated.";
3048 EXPECT_FALSE( 3032 EXPECT_FALSE(
3049 default_receive_config.rtp.rtcp_xr.receiver_reference_time_report) 3033 default_receive_config.rtp.rtcp_xr.receiver_reference_time_report)
3050 << "RTCP XR settings require rtcp-xr to be negotiated."; 3034 << "RTCP XR settings require rtcp-xr to be negotiated.";
3051 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) 3035 EXPECT_TRUE(default_receive_config.rtp.rtx.empty())
3052 << "Enabling RTX requires rtpmap: rtx negotiation."; 3036 << "Enabling RTX requires rtpmap: rtx negotiation.";
3053 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) 3037 EXPECT_TRUE(default_receive_config.rtp.extensions.empty())
3054 << "Enabling RTP extensions require negotiation."; 3038 << "Enabling RTP extensions require negotiation.";
3055 3039
3056 VerifyEmptyNackConfig(default_receive_config.rtp.nack); 3040 VerifyEmptyNackConfig(default_receive_config.rtp.nack);
3057 VerifyEmptyFecConfig(default_receive_config.rtp.fec); 3041 VerifyEmptyFecConfig(default_receive_config.rtp.fec);
3058 } 3042 }
3059 3043
3060 } // namespace webrtc 3044 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/call_perf_tests.cc ('k') | webrtc/video/full_stack.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698