OLD | NEW |
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 receiver_transport.SetReceiver(sender_call_->Receiver()); | 251 receiver_transport.SetReceiver(sender_call_->Receiver()); |
252 | 252 |
253 CreateSendConfig(1, 0, &sender_transport); | 253 CreateSendConfig(1, 0, &sender_transport); |
254 CreateMatchingReceiveConfigs(&receiver_transport); | 254 CreateMatchingReceiveConfigs(&receiver_transport); |
255 video_receive_configs_[0].renderer = &renderer; | 255 video_receive_configs_[0].renderer = &renderer; |
256 | 256 |
257 CreateVideoStreams(); | 257 CreateVideoStreams(); |
258 Start(); | 258 Start(); |
259 | 259 |
260 std::unique_ptr<test::FrameGenerator> frame_generator( | 260 std::unique_ptr<test::FrameGenerator> frame_generator( |
261 test::FrameGenerator::CreateChromaGenerator( | 261 test::FrameGenerator::CreateChromaGenerator(kDefaultWidth, |
262 video_encoder_config_.streams[0].width, | 262 kDefaultHeight)); |
263 video_encoder_config_.streams[0].height)); | |
264 test::FrameForwarder frame_forwarder; | 263 test::FrameForwarder frame_forwarder; |
265 video_send_stream_->SetSource(&frame_forwarder); | 264 video_send_stream_->SetSource(&frame_forwarder); |
266 frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame()); | 265 frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame()); |
267 | 266 |
268 EXPECT_TRUE(renderer.Wait()) | 267 EXPECT_TRUE(renderer.Wait()) |
269 << "Timed out while waiting for the frame to render."; | 268 << "Timed out while waiting for the frame to render."; |
270 | 269 |
271 Stop(); | 270 Stop(); |
272 | 271 |
273 sender_transport.StopSending(); | 272 sender_transport.StopSending(); |
(...skipping 23 matching lines...) Expand all Loading... |
297 << "Timed out while waiting for enough frames to be decoded."; | 296 << "Timed out while waiting for enough frames to be decoded."; |
298 } | 297 } |
299 | 298 |
300 void ModifyVideoConfigs( | 299 void ModifyVideoConfigs( |
301 VideoSendStream::Config* send_config, | 300 VideoSendStream::Config* send_config, |
302 std::vector<VideoReceiveStream::Config>* receive_configs, | 301 std::vector<VideoReceiveStream::Config>* receive_configs, |
303 VideoEncoderConfig* encoder_config) override { | 302 VideoEncoderConfig* encoder_config) override { |
304 send_config->encoder_settings.encoder = encoder_.get(); | 303 send_config->encoder_settings.encoder = encoder_.get(); |
305 send_config->encoder_settings.payload_name = payload_name_; | 304 send_config->encoder_settings.payload_name = payload_name_; |
306 send_config->encoder_settings.payload_type = 126; | 305 send_config->encoder_settings.payload_type = 126; |
307 encoder_config->streams[0].min_bitrate_bps = 50000; | |
308 encoder_config->streams[0].target_bitrate_bps = | |
309 encoder_config->streams[0].max_bitrate_bps = 2000000; | |
310 | 306 |
311 (*receive_configs)[0].renderer = this; | 307 (*receive_configs)[0].renderer = this; |
312 (*receive_configs)[0].decoders.resize(1); | 308 (*receive_configs)[0].decoders.resize(1); |
313 (*receive_configs)[0].decoders[0].payload_type = | 309 (*receive_configs)[0].decoders[0].payload_type = |
314 send_config->encoder_settings.payload_type; | 310 send_config->encoder_settings.payload_type; |
315 (*receive_configs)[0].decoders[0].payload_name = | 311 (*receive_configs)[0].decoders[0].payload_name = |
316 send_config->encoder_settings.payload_name; | 312 send_config->encoder_settings.payload_name; |
317 (*receive_configs)[0].decoders[0].decoder = decoder_.get(); | 313 (*receive_configs)[0].decoders[0].decoder = decoder_.get(); |
318 } | 314 } |
319 | 315 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 std::vector<VideoReceiveStream::Config>* receive_configs, | 781 std::vector<VideoReceiveStream::Config>* receive_configs, |
786 VideoEncoderConfig* encoder_config) override { | 782 VideoEncoderConfig* encoder_config) override { |
787 // Configure hybrid NACK/FEC. | 783 // Configure hybrid NACK/FEC. |
788 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 784 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
789 send_config->rtp.fec.red_payload_type = kRedPayloadType; | 785 send_config->rtp.fec.red_payload_type = kRedPayloadType; |
790 send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 786 send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; |
791 // Set codec to VP8, otherwise NACK/FEC hybrid will be disabled. | 787 // Set codec to VP8, otherwise NACK/FEC hybrid will be disabled. |
792 send_config->encoder_settings.encoder = encoder_.get(); | 788 send_config->encoder_settings.encoder = encoder_.get(); |
793 send_config->encoder_settings.payload_name = "VP8"; | 789 send_config->encoder_settings.payload_name = "VP8"; |
794 send_config->encoder_settings.payload_type = kFakeVideoSendPayloadType; | 790 send_config->encoder_settings.payload_type = kFakeVideoSendPayloadType; |
795 encoder_config->streams[0].min_bitrate_bps = 50000; | |
796 encoder_config->streams[0].max_bitrate_bps = | |
797 encoder_config->streams[0].target_bitrate_bps = 2000000; | |
798 | 791 |
799 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 792 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
800 (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType; | 793 (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType; |
801 (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 794 (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; |
802 | 795 |
803 (*receive_configs)[0].decoders.resize(1); | 796 (*receive_configs)[0].decoders.resize(1); |
804 (*receive_configs)[0].decoders[0].payload_type = | 797 (*receive_configs)[0].decoders[0].payload_type = |
805 send_config->encoder_settings.payload_type; | 798 send_config->encoder_settings.payload_type; |
806 (*receive_configs)[0].decoders[0].payload_name = | 799 (*receive_configs)[0].decoders[0].payload_name = |
807 send_config->encoder_settings.payload_name; | 800 send_config->encoder_settings.payload_name; |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 test::DirectTransport send_transport(sender_call_.get()); | 1106 test::DirectTransport send_transport(sender_call_.get()); |
1114 test::DirectTransport receive_transport(receiver_call_.get()); | 1107 test::DirectTransport receive_transport(receiver_call_.get()); |
1115 PacketInputObserver input_observer(receiver_call_->Receiver()); | 1108 PacketInputObserver input_observer(receiver_call_->Receiver()); |
1116 send_transport.SetReceiver(&input_observer); | 1109 send_transport.SetReceiver(&input_observer); |
1117 receive_transport.SetReceiver(sender_call_->Receiver()); | 1110 receive_transport.SetReceiver(sender_call_->Receiver()); |
1118 | 1111 |
1119 CreateSendConfig(1, 0, &send_transport); | 1112 CreateSendConfig(1, 0, &send_transport); |
1120 CreateMatchingReceiveConfigs(&receive_transport); | 1113 CreateMatchingReceiveConfigs(&receive_transport); |
1121 | 1114 |
1122 CreateVideoStreams(); | 1115 CreateVideoStreams(); |
1123 CreateFrameGeneratorCapturer(); | 1116 CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth, |
| 1117 kDefaultHeight); |
1124 Start(); | 1118 Start(); |
1125 | 1119 |
1126 receiver_call_->DestroyVideoReceiveStream(video_receive_streams_[0]); | 1120 receiver_call_->DestroyVideoReceiveStream(video_receive_streams_[0]); |
1127 video_receive_streams_.clear(); | 1121 video_receive_streams_.clear(); |
1128 | 1122 |
1129 // Wait() waits for a received packet. | 1123 // Wait() waits for a received packet. |
1130 EXPECT_TRUE(input_observer.Wait()); | 1124 EXPECT_TRUE(input_observer.Wait()); |
1131 | 1125 |
1132 Stop(); | 1126 Stop(); |
1133 | 1127 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 uint32_t ssrc = codec_settings[i].ssrc; | 1264 uint32_t ssrc = codec_settings[i].ssrc; |
1271 int width = codec_settings[i].width; | 1265 int width = codec_settings[i].width; |
1272 int height = codec_settings[i].height; | 1266 int height = codec_settings[i].height; |
1273 | 1267 |
1274 VideoSendStream::Config send_config(sender_transport.get()); | 1268 VideoSendStream::Config send_config(sender_transport.get()); |
1275 send_config.rtp.ssrcs.push_back(ssrc); | 1269 send_config.rtp.ssrcs.push_back(ssrc); |
1276 send_config.encoder_settings.encoder = encoders[i].get(); | 1270 send_config.encoder_settings.encoder = encoders[i].get(); |
1277 send_config.encoder_settings.payload_name = "VP8"; | 1271 send_config.encoder_settings.payload_name = "VP8"; |
1278 send_config.encoder_settings.payload_type = 124; | 1272 send_config.encoder_settings.payload_type = 124; |
1279 VideoEncoderConfig encoder_config; | 1273 VideoEncoderConfig encoder_config; |
1280 encoder_config.streams = test::CreateVideoStreams(1); | 1274 test::FillEncoderConfiguration(1, &encoder_config); |
1281 VideoStream* stream = &encoder_config.streams[0]; | 1275 encoder_config.max_bitrate_bps = 100000; |
1282 stream->width = width; | |
1283 stream->height = height; | |
1284 stream->max_framerate = 5; | |
1285 stream->min_bitrate_bps = stream->target_bitrate_bps = | |
1286 stream->max_bitrate_bps = 100000; | |
1287 | 1276 |
1288 UpdateSendConfig(i, &send_config, &encoder_config, &frame_generators[i]); | 1277 UpdateSendConfig(i, &send_config, &encoder_config, &frame_generators[i]); |
1289 | 1278 |
1290 send_streams[i] = sender_call->CreateVideoSendStream( | 1279 send_streams[i] = sender_call->CreateVideoSendStream( |
1291 send_config.Copy(), encoder_config.Copy()); | 1280 send_config.Copy(), encoder_config.Copy()); |
1292 send_streams[i]->Start(); | 1281 send_streams[i]->Start(); |
1293 | 1282 |
1294 VideoReceiveStream::Config receive_config(receiver_transport.get()); | 1283 VideoReceiveStream::Config receive_config(receiver_transport.get()); |
1295 receive_config.rtp.remote_ssrc = ssrc; | 1284 receive_config.rtp.remote_ssrc = ssrc; |
1296 receive_config.rtp.local_ssrc = test::CallTest::kReceiverLocalVideoSsrc; | 1285 receive_config.rtp.local_ssrc = test::CallTest::kReceiverLocalVideoSsrc; |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 size_t stream_index, | 1543 size_t stream_index, |
1555 VideoSendStream::Config* send_config, | 1544 VideoSendStream::Config* send_config, |
1556 VideoEncoderConfig* encoder_config, | 1545 VideoEncoderConfig* encoder_config, |
1557 test::FrameGeneratorCapturer** frame_generator) override { | 1546 test::FrameGeneratorCapturer** frame_generator) override { |
1558 send_config->rtp.extensions.clear(); | 1547 send_config->rtp.extensions.clear(); |
1559 send_config->rtp.extensions.push_back(RtpExtension( | 1548 send_config->rtp.extensions.push_back(RtpExtension( |
1560 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); | 1549 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
1561 | 1550 |
1562 // Force some padding to be sent. | 1551 // Force some padding to be sent. |
1563 const int kPaddingBitrateBps = 50000; | 1552 const int kPaddingBitrateBps = 50000; |
1564 int total_target_bitrate = 0; | 1553 encoder_config->max_bitrate_bps = 1000000; |
1565 for (const VideoStream& stream : encoder_config->streams) | |
1566 total_target_bitrate += stream.target_bitrate_bps; | |
1567 encoder_config->min_transmit_bitrate_bps = | 1554 encoder_config->min_transmit_bitrate_bps = |
1568 total_target_bitrate + kPaddingBitrateBps; | 1555 encoder_config->max_bitrate_bps + kPaddingBitrateBps; |
1569 | 1556 |
1570 // Configure RTX for redundant payload padding. | 1557 // Configure RTX for redundant payload padding. |
1571 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 1558 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
1572 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[stream_index]); | 1559 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[stream_index]); |
1573 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; | 1560 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; |
1574 rtx_to_media_ssrcs_[kSendRtxSsrcs[stream_index]] = | 1561 rtx_to_media_ssrcs_[kSendRtxSsrcs[stream_index]] = |
1575 send_config->rtp.ssrcs[0]; | 1562 send_config->rtp.ssrcs[0]; |
1576 | 1563 |
1577 if (stream_index == 0) | 1564 if (stream_index == 0) |
1578 first_media_ssrc_ = send_config->rtp.ssrcs[0]; | 1565 first_media_ssrc_ = send_config->rtp.ssrcs[0]; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 | 1745 |
1759 CreateSendConfig(1, 0, &sender_transport); | 1746 CreateSendConfig(1, 0, &sender_transport); |
1760 CreateMatchingReceiveConfigs(&receiver_transport); | 1747 CreateMatchingReceiveConfigs(&receiver_transport); |
1761 video_send_config_.post_encode_callback = &post_encode_observer; | 1748 video_send_config_.post_encode_callback = &post_encode_observer; |
1762 video_receive_configs_[0].pre_decode_callback = &pre_decode_observer; | 1749 video_receive_configs_[0].pre_decode_callback = &pre_decode_observer; |
1763 | 1750 |
1764 CreateVideoStreams(); | 1751 CreateVideoStreams(); |
1765 Start(); | 1752 Start(); |
1766 | 1753 |
1767 std::unique_ptr<test::FrameGenerator> frame_generator( | 1754 std::unique_ptr<test::FrameGenerator> frame_generator( |
1768 test::FrameGenerator::CreateChromaGenerator( | 1755 test::FrameGenerator::CreateChromaGenerator(kDefaultWidth, |
1769 video_encoder_config_.streams[0].width, | 1756 kDefaultHeight)); |
1770 video_encoder_config_.streams[0].height)); | |
1771 test::FrameForwarder forwarder; | 1757 test::FrameForwarder forwarder; |
1772 video_send_stream_->SetSource(&forwarder); | 1758 video_send_stream_->SetSource(&forwarder); |
1773 forwarder.IncomingCapturedFrame(*frame_generator->NextFrame()); | 1759 forwarder.IncomingCapturedFrame(*frame_generator->NextFrame()); |
1774 | 1760 |
1775 EXPECT_TRUE(post_encode_observer.Wait()) | 1761 EXPECT_TRUE(post_encode_observer.Wait()) |
1776 << "Timed out while waiting for send-side encoded-frame callback."; | 1762 << "Timed out while waiting for send-side encoded-frame callback."; |
1777 | 1763 |
1778 EXPECT_TRUE(pre_decode_observer.Wait()) | 1764 EXPECT_TRUE(pre_decode_observer.Wait()) |
1779 << "Timed out while waiting for pre-decode encoded-frame callback."; | 1765 << "Timed out while waiting for pre-decode encoded-frame callback."; |
1780 | 1766 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 VideoSendStream::Config* send_config, | 1897 VideoSendStream::Config* send_config, |
1912 std::vector<VideoReceiveStream::Config>* receive_configs, | 1898 std::vector<VideoReceiveStream::Config>* receive_configs, |
1913 VideoEncoderConfig* encoder_config) override { | 1899 VideoEncoderConfig* encoder_config) override { |
1914 ASSERT_EQ(1u, send_config->rtp.ssrcs.size()); | 1900 ASSERT_EQ(1u, send_config->rtp.ssrcs.size()); |
1915 send_config->rtp.extensions.clear(); | 1901 send_config->rtp.extensions.clear(); |
1916 send_config->rtp.extensions.push_back( | 1902 send_config->rtp.extensions.push_back( |
1917 RtpExtension(RtpExtension::kTransportSequenceNumberUri, | 1903 RtpExtension(RtpExtension::kTransportSequenceNumberUri, |
1918 test::kTransportSequenceNumberExtensionId)); | 1904 test::kTransportSequenceNumberExtensionId)); |
1919 sender_ssrc_ = send_config->rtp.ssrcs[0]; | 1905 sender_ssrc_ = send_config->rtp.ssrcs[0]; |
1920 | 1906 |
1921 encoder_config->streams[0].max_bitrate_bps = | 1907 encoder_config->max_bitrate_bps = 2000000; |
1922 encoder_config->streams[0].target_bitrate_bps = 2000000; | |
1923 | 1908 |
1924 ASSERT_EQ(1u, receive_configs->size()); | 1909 ASSERT_EQ(1u, receive_configs->size()); |
1925 (*receive_configs)[0].rtp.remb = false; | 1910 (*receive_configs)[0].rtp.remb = false; |
1926 (*receive_configs)[0].rtp.transport_cc = true; | 1911 (*receive_configs)[0].rtp.transport_cc = true; |
1927 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; | 1912 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; |
1928 RtpRtcp::Configuration config; | 1913 RtpRtcp::Configuration config; |
1929 config.receiver_only = true; | 1914 config.receiver_only = true; |
1930 config.clock = clock_; | 1915 config.clock = clock_; |
1931 config.outgoing_transport = receive_transport_; | 1916 config.outgoing_transport = receive_transport_; |
1932 config.retransmission_rate_limiter = &retransmission_rate_limiter_; | 1917 config.retransmission_rate_limiter = &retransmission_rate_limiter_; |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 EXPECT_EQ(1, | 2238 EXPECT_EQ(1, |
2254 metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent")); | 2239 metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent")); |
2255 | 2240 |
2256 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InputWidthInPixels")); | 2241 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InputWidthInPixels")); |
2257 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InputHeightInPixels")); | 2242 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InputHeightInPixels")); |
2258 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SentWidthInPixels")); | 2243 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SentWidthInPixels")); |
2259 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SentHeightInPixels")); | 2244 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SentHeightInPixels")); |
2260 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.ReceivedWidthInPixels")); | 2245 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.ReceivedWidthInPixels")); |
2261 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.ReceivedHeightInPixels")); | 2246 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.ReceivedHeightInPixels")); |
2262 | 2247 |
2263 EXPECT_EQ(1, metrics::NumEvents( | 2248 EXPECT_EQ(1, metrics::NumEvents(video_prefix + "InputWidthInPixels", |
2264 video_prefix + "InputWidthInPixels", | 2249 kDefaultWidth)); |
2265 static_cast<int>(video_encoder_config_.streams[0].width))); | 2250 EXPECT_EQ(1, metrics::NumEvents(video_prefix + "InputHeightInPixels", |
2266 EXPECT_EQ(1, metrics::NumEvents( | 2251 kDefaultHeight)); |
2267 video_prefix + "InputHeightInPixels", | 2252 EXPECT_EQ( |
2268 static_cast<int>(video_encoder_config_.streams[0].height))); | 2253 1, metrics::NumEvents(video_prefix + "SentWidthInPixels", kDefaultWidth)); |
2269 EXPECT_EQ(1, metrics::NumEvents( | 2254 EXPECT_EQ(1, metrics::NumEvents(video_prefix + "SentHeightInPixels", |
2270 video_prefix + "SentWidthInPixels", | 2255 kDefaultHeight)); |
2271 static_cast<int>(video_encoder_config_.streams[0].width))); | 2256 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.ReceivedWidthInPixels", |
2272 EXPECT_EQ(1, metrics::NumEvents( | 2257 kDefaultWidth)); |
2273 video_prefix + "SentHeightInPixels", | 2258 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.ReceivedHeightInPixels", |
2274 static_cast<int>(video_encoder_config_.streams[0].height))); | 2259 kDefaultHeight)); |
2275 EXPECT_EQ(1, metrics::NumEvents( | |
2276 "WebRTC.Video.ReceivedWidthInPixels", | |
2277 static_cast<int>(video_encoder_config_.streams[0].width))); | |
2278 EXPECT_EQ(1, metrics::NumEvents( | |
2279 "WebRTC.Video.ReceivedHeightInPixels", | |
2280 static_cast<int>(video_encoder_config_.streams[0].height))); | |
2281 | 2260 |
2282 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InputFramesPerSecond")); | 2261 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InputFramesPerSecond")); |
2283 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SentFramesPerSecond")); | 2262 EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SentFramesPerSecond")); |
2284 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DecodedFramesPerSecond")); | 2263 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DecodedFramesPerSecond")); |
2285 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.RenderFramesPerSecond")); | 2264 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.RenderFramesPerSecond")); |
2286 | 2265 |
2287 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.JitterBufferDelayInMs")); | 2266 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.JitterBufferDelayInMs")); |
2288 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.TargetDelayInMs")); | 2267 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.TargetDelayInMs")); |
2289 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.CurrentDelayInMs")); | 2268 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.CurrentDelayInMs")); |
2290 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.OnewayDelayInMs")); | 2269 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.OnewayDelayInMs")); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2476 } | 2455 } |
2477 | 2456 |
2478 if (ssrcs_to_observe_ == 0) | 2457 if (ssrcs_to_observe_ == 0) |
2479 observation_complete_.Set(); | 2458 observation_complete_.Set(); |
2480 | 2459 |
2481 return SEND_PACKET; | 2460 return SEND_PACKET; |
2482 } | 2461 } |
2483 | 2462 |
2484 size_t GetNumVideoStreams() const override { return num_ssrcs_; } | 2463 size_t GetNumVideoStreams() const override { return num_ssrcs_; } |
2485 | 2464 |
| 2465 // This test use other VideoStream settings than the the default settings |
| 2466 // implemented in DefaultVideoStreamFactory. Therefore this test implement |
| 2467 // its own VideoEncoderConfig::VideoStreamFactoryInterface which is created |
| 2468 // in ModifyVideoConfigs. |
| 2469 class VideoStreamFactory |
| 2470 : public VideoEncoderConfig::VideoStreamFactoryInterface { |
| 2471 public: |
| 2472 VideoStreamFactory() {} |
| 2473 |
| 2474 private: |
| 2475 std::vector<VideoStream> CreateEncoderStreams( |
| 2476 int width, |
| 2477 int height, |
| 2478 const VideoEncoderConfig& encoder_config) override { |
| 2479 std::vector<VideoStream> streams = |
| 2480 test::CreateVideoStreams(width, height, encoder_config); |
| 2481 // Set low simulcast bitrates to not have to wait for bandwidth ramp-up. |
| 2482 for (size_t i = 0; i < encoder_config.number_of_streams; ++i) { |
| 2483 streams[i].min_bitrate_bps = 10000; |
| 2484 streams[i].target_bitrate_bps = 15000; |
| 2485 streams[i].max_bitrate_bps = 20000; |
| 2486 } |
| 2487 return streams; |
| 2488 } |
| 2489 }; |
| 2490 |
2486 void ModifyVideoConfigs( | 2491 void ModifyVideoConfigs( |
2487 VideoSendStream::Config* send_config, | 2492 VideoSendStream::Config* send_config, |
2488 std::vector<VideoReceiveStream::Config>* receive_configs, | 2493 std::vector<VideoReceiveStream::Config>* receive_configs, |
2489 VideoEncoderConfig* encoder_config) override { | 2494 VideoEncoderConfig* encoder_config) override { |
2490 if (num_ssrcs_ > 1) { | 2495 encoder_config->video_stream_factory = |
2491 // Set low simulcast bitrates to not have to wait for bandwidth ramp-up. | 2496 new rtc::RefCountedObject<VideoStreamFactory>(); |
2492 for (size_t i = 0; i < encoder_config->streams.size(); ++i) { | |
2493 encoder_config->streams[i].min_bitrate_bps = 10000; | |
2494 encoder_config->streams[i].target_bitrate_bps = 15000; | |
2495 encoder_config->streams[i].max_bitrate_bps = 20000; | |
2496 } | |
2497 } | |
2498 | |
2499 video_encoder_config_all_streams_ = encoder_config->Copy(); | 2497 video_encoder_config_all_streams_ = encoder_config->Copy(); |
2500 if (send_single_ssrc_first_) | 2498 if (send_single_ssrc_first_) |
2501 encoder_config->streams.resize(1); | 2499 encoder_config->number_of_streams = 1; |
2502 } | 2500 } |
2503 | 2501 |
2504 void OnVideoStreamsCreated( | 2502 void OnVideoStreamsCreated( |
2505 VideoSendStream* send_stream, | 2503 VideoSendStream* send_stream, |
2506 const std::vector<VideoReceiveStream*>& receive_streams) override { | 2504 const std::vector<VideoReceiveStream*>& receive_streams) override { |
2507 send_stream_ = send_stream; | 2505 send_stream_ = send_stream; |
2508 } | 2506 } |
2509 | 2507 |
2510 void PerformTest() override { | 2508 void PerformTest() override { |
2511 EXPECT_TRUE(Wait()) << "Timed out while waiting for " | 2509 EXPECT_TRUE(Wait()) << "Timed out while waiting for " |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 VideoSendStream* send_stream, | 2549 VideoSendStream* send_stream, |
2552 const std::vector<VideoReceiveStream*>& receive_streams) override { | 2550 const std::vector<VideoReceiveStream*>& receive_streams) override { |
2553 send_stream_ = send_stream; | 2551 send_stream_ = send_stream; |
2554 } | 2552 } |
2555 | 2553 |
2556 void ModifyVideoConfigs( | 2554 void ModifyVideoConfigs( |
2557 VideoSendStream::Config* send_config, | 2555 VideoSendStream::Config* send_config, |
2558 std::vector<VideoReceiveStream::Config>* receive_configs, | 2556 std::vector<VideoReceiveStream::Config>* receive_configs, |
2559 VideoEncoderConfig* encoder_config) override { | 2557 VideoEncoderConfig* encoder_config) override { |
2560 send_config->encoder_settings.encoder = this; | 2558 send_config->encoder_settings.encoder = this; |
2561 RTC_DCHECK_EQ(1u, encoder_config->streams.size()); | 2559 RTC_DCHECK_EQ(1u, encoder_config->number_of_streams); |
2562 } | 2560 } |
2563 | 2561 |
2564 int32_t SetRates(uint32_t new_target_bitrate, uint32_t framerate) override { | 2562 int32_t SetRates(uint32_t new_target_bitrate, uint32_t framerate) override { |
2565 // Make sure not to trigger on any default zero bitrates. | 2563 // Make sure not to trigger on any default zero bitrates. |
2566 if (new_target_bitrate == 0) | 2564 if (new_target_bitrate == 0) |
2567 return 0; | 2565 return 0; |
2568 rtc::CritScope lock(&crit_); | 2566 rtc::CritScope lock(&crit_); |
2569 bitrate_kbps_ = new_target_bitrate; | 2567 bitrate_kbps_ = new_target_bitrate; |
2570 observation_complete_.Set(); | 2568 observation_complete_.Set(); |
2571 return 0; | 2569 return 0; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2823 return new test::PacketTransport( | 2821 return new test::PacketTransport( |
2824 sender_call, this, test::PacketTransport::kSender, network_config); | 2822 sender_call, this, test::PacketTransport::kSender, network_config); |
2825 } | 2823 } |
2826 | 2824 |
2827 Call::Config GetSenderCallConfig() override { | 2825 Call::Config GetSenderCallConfig() override { |
2828 Call::Config config = EndToEndTest::GetSenderCallConfig(); | 2826 Call::Config config = EndToEndTest::GetSenderCallConfig(); |
2829 config.bitrate_config.start_bitrate_bps = kStartBitrateBps; | 2827 config.bitrate_config.start_bitrate_bps = kStartBitrateBps; |
2830 return config; | 2828 return config; |
2831 } | 2829 } |
2832 | 2830 |
| 2831 // This test use other VideoStream settings than the the default settings |
| 2832 // implemented in DefaultVideoStreamFactory. Therefore this test implement |
| 2833 // its own VideoEncoderConfig::VideoStreamFactoryInterface which is created |
| 2834 // in ModifyVideoConfigs. |
| 2835 class VideoStreamFactory |
| 2836 : public VideoEncoderConfig::VideoStreamFactoryInterface { |
| 2837 public: |
| 2838 VideoStreamFactory() {} |
| 2839 |
| 2840 private: |
| 2841 std::vector<VideoStream> CreateEncoderStreams( |
| 2842 int width, |
| 2843 int height, |
| 2844 const VideoEncoderConfig& encoder_config) override { |
| 2845 std::vector<VideoStream> streams = |
| 2846 test::CreateVideoStreams(width, height, encoder_config); |
| 2847 // Set low simulcast bitrates to not have to wait for bandwidth ramp-up. |
| 2848 for (size_t i = 0; i < encoder_config.number_of_streams; ++i) { |
| 2849 streams[i].min_bitrate_bps = 10000; |
| 2850 streams[i].target_bitrate_bps = 15000; |
| 2851 streams[i].max_bitrate_bps = 20000; |
| 2852 } |
| 2853 return streams; |
| 2854 } |
| 2855 }; |
| 2856 |
2833 void ModifyVideoConfigs( | 2857 void ModifyVideoConfigs( |
2834 VideoSendStream::Config* send_config, | 2858 VideoSendStream::Config* send_config, |
2835 std::vector<VideoReceiveStream::Config>* receive_configs, | 2859 std::vector<VideoReceiveStream::Config>* receive_configs, |
2836 VideoEncoderConfig* encoder_config) override { | 2860 VideoEncoderConfig* encoder_config) override { |
2837 // Set low rates to avoid waiting for rampup. | 2861 encoder_config->video_stream_factory = |
2838 for (size_t i = 0; i < encoder_config->streams.size(); ++i) { | 2862 new rtc::RefCountedObject<VideoStreamFactory>(); |
2839 encoder_config->streams[i].min_bitrate_bps = 10000; | |
2840 encoder_config->streams[i].target_bitrate_bps = 15000; | |
2841 encoder_config->streams[i].max_bitrate_bps = 20000; | |
2842 } | |
2843 send_config->pre_encode_callback = this; // Used to inject delay. | 2863 send_config->pre_encode_callback = this; // Used to inject delay. |
2844 expected_cname_ = send_config->rtp.c_name = "SomeCName"; | 2864 expected_cname_ = send_config->rtp.c_name = "SomeCName"; |
2845 | 2865 |
2846 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 2866 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
2847 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; | 2867 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; |
2848 | 2868 |
2849 const std::vector<uint32_t>& ssrcs = send_config->rtp.ssrcs; | 2869 const std::vector<uint32_t>& ssrcs = send_config->rtp.ssrcs; |
2850 for (size_t i = 0; i < ssrcs.size(); ++i) { | 2870 for (size_t i = 0; i < ssrcs.size(); ++i) { |
2851 expected_send_ssrcs_.insert(ssrcs[i]); | 2871 expected_send_ssrcs_.insert(ssrcs[i]); |
2852 expected_receive_ssrcs_.push_back( | 2872 expected_receive_ssrcs_.push_back( |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3025 observed_redundant_retransmission_[header.ssrc] = true; | 3045 observed_redundant_retransmission_[header.ssrc] = true; |
3026 if (--ssrcs_to_observe_ == 0) | 3046 if (--ssrcs_to_observe_ == 0) |
3027 observation_complete_.Set(); | 3047 observation_complete_.Set(); |
3028 } | 3048 } |
3029 | 3049 |
3030 return SEND_PACKET; | 3050 return SEND_PACKET; |
3031 } | 3051 } |
3032 | 3052 |
3033 size_t GetNumVideoStreams() const override { return kNumSsrcs; } | 3053 size_t GetNumVideoStreams() const override { return kNumSsrcs; } |
3034 | 3054 |
| 3055 // This test use other VideoStream settings than the the default settings |
| 3056 // implemented in DefaultVideoStreamFactory. Therefore this test implement |
| 3057 // its own VideoEncoderConfig::VideoStreamFactoryInterface which is created |
| 3058 // in ModifyVideoConfigs. |
| 3059 class VideoStreamFactory |
| 3060 : public VideoEncoderConfig::VideoStreamFactoryInterface { |
| 3061 public: |
| 3062 VideoStreamFactory() {} |
| 3063 |
| 3064 private: |
| 3065 std::vector<VideoStream> CreateEncoderStreams( |
| 3066 int width, |
| 3067 int height, |
| 3068 const VideoEncoderConfig& encoder_config) override { |
| 3069 std::vector<VideoStream> streams = |
| 3070 test::CreateVideoStreams(width, height, encoder_config); |
| 3071 // Set low simulcast bitrates to not have to wait for bandwidth ramp-up. |
| 3072 for (size_t i = 0; i < encoder_config.number_of_streams; ++i) { |
| 3073 streams[i].min_bitrate_bps = 10000; |
| 3074 streams[i].target_bitrate_bps = 15000; |
| 3075 streams[i].max_bitrate_bps = 20000; |
| 3076 } |
| 3077 return streams; |
| 3078 } |
| 3079 }; |
| 3080 |
3035 void ModifyVideoConfigs( | 3081 void ModifyVideoConfigs( |
3036 VideoSendStream::Config* send_config, | 3082 VideoSendStream::Config* send_config, |
3037 std::vector<VideoReceiveStream::Config>* receive_configs, | 3083 std::vector<VideoReceiveStream::Config>* receive_configs, |
3038 VideoEncoderConfig* encoder_config) override { | 3084 VideoEncoderConfig* encoder_config) override { |
3039 // Set low simulcast bitrates to not have to wait for bandwidth ramp-up. | 3085 // Set low simulcast bitrates to not have to wait for bandwidth ramp-up. |
3040 for (size_t i = 0; i < encoder_config->streams.size(); ++i) { | 3086 encoder_config->video_stream_factory = |
3041 encoder_config->streams[i].min_bitrate_bps = 10000; | 3087 new rtc::RefCountedObject<VideoStreamFactory>(); |
3042 encoder_config->streams[i].target_bitrate_bps = 15000; | |
3043 encoder_config->streams[i].max_bitrate_bps = 20000; | |
3044 } | |
3045 | |
3046 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; | 3088 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; |
3047 | 3089 |
3048 for (size_t i = 0; i < kNumSsrcs; ++i) | 3090 for (size_t i = 0; i < kNumSsrcs; ++i) |
3049 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]); | 3091 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]); |
3050 | 3092 |
3051 // Significantly higher than max bitrates for all video streams -> forcing | 3093 // Significantly higher than max bitrates for all video streams -> forcing |
3052 // padding to trigger redundant padding on all RTX SSRCs. | 3094 // padding to trigger redundant padding on all RTX SSRCs. |
3053 encoder_config->min_transmit_bitrate_bps = 100000; | 3095 encoder_config->min_transmit_bitrate_bps = 100000; |
3054 } | 3096 } |
3055 | 3097 |
3056 void PerformTest() override { | 3098 void PerformTest() override { |
3057 EXPECT_TRUE(Wait()) | 3099 EXPECT_TRUE(Wait()) |
3058 << "Timed out while waiting for redundant payloads on all SSRCs."; | 3100 << "Timed out while waiting for redundant payloads on all SSRCs."; |
3059 } | 3101 } |
3060 | 3102 |
3061 private: | 3103 private: |
3062 size_t ssrcs_to_observe_; | 3104 size_t ssrcs_to_observe_; |
3063 std::map<uint32_t, bool> observed_redundant_retransmission_; | 3105 std::map<uint32_t, bool> observed_redundant_retransmission_; |
3064 std::map<uint32_t, bool> registered_rtx_ssrc_; | 3106 std::map<uint32_t, bool> registered_rtx_ssrc_; |
3065 } test; | 3107 } test; |
3066 | 3108 |
3067 RunBaseTest(&test); | 3109 RunBaseTest(&test); |
3068 } | 3110 } |
3069 | 3111 |
3070 void EndToEndTest::TestRtpStatePreservation(bool use_rtx, | 3112 void EndToEndTest::TestRtpStatePreservation(bool use_rtx, |
3071 bool provoke_rtcpsr_before_rtp) { | 3113 bool provoke_rtcpsr_before_rtp) { |
| 3114 // This test use other VideoStream settings than the the default settings |
| 3115 // implemented in DefaultVideoStreamFactory. Therefore this test implement |
| 3116 // its own VideoEncoderConfig::VideoStreamFactoryInterface which is created |
| 3117 // in ModifyVideoConfigs. |
| 3118 class VideoStreamFactory |
| 3119 : public VideoEncoderConfig::VideoStreamFactoryInterface { |
| 3120 public: |
| 3121 VideoStreamFactory() {} |
| 3122 |
| 3123 private: |
| 3124 std::vector<VideoStream> CreateEncoderStreams( |
| 3125 int width, |
| 3126 int height, |
| 3127 const VideoEncoderConfig& encoder_config) override { |
| 3128 std::vector<VideoStream> streams = |
| 3129 test::CreateVideoStreams(width, height, encoder_config); |
| 3130 |
| 3131 if (encoder_config.number_of_streams > 1) { |
| 3132 // Lower bitrates so that all streams send initially. |
| 3133 RTC_DCHECK_EQ(3u, encoder_config.number_of_streams); |
| 3134 for (size_t i = 0; i < encoder_config.number_of_streams; ++i) { |
| 3135 streams[i].min_bitrate_bps = 10000; |
| 3136 streams[i].target_bitrate_bps = 15000; |
| 3137 streams[i].max_bitrate_bps = 20000; |
| 3138 } |
| 3139 } else { |
| 3140 // Use the same total bitrates when sending a single stream to avoid |
| 3141 // lowering |
| 3142 // the bitrate estimate and requiring a subsequent rampup. |
| 3143 streams[0].min_bitrate_bps = 3 * 10000; |
| 3144 streams[0].target_bitrate_bps = 3 * 15000; |
| 3145 streams[0].max_bitrate_bps = 3 * 20000; |
| 3146 } |
| 3147 return streams; |
| 3148 } |
| 3149 }; |
| 3150 |
3072 class RtpSequenceObserver : public test::RtpRtcpObserver { | 3151 class RtpSequenceObserver : public test::RtpRtcpObserver { |
3073 public: | 3152 public: |
3074 explicit RtpSequenceObserver(bool use_rtx) | 3153 explicit RtpSequenceObserver(bool use_rtx) |
3075 : test::RtpRtcpObserver(kDefaultTimeoutMs), | 3154 : test::RtpRtcpObserver(kDefaultTimeoutMs), |
3076 ssrcs_to_observe_(kNumSsrcs) { | 3155 ssrcs_to_observe_(kNumSsrcs) { |
3077 for (size_t i = 0; i < kNumSsrcs; ++i) { | 3156 for (size_t i = 0; i < kNumSsrcs; ++i) { |
3078 ssrc_is_rtx_[kVideoSendSsrcs[i]] = false; | 3157 ssrc_is_rtx_[kVideoSendSsrcs[i]] = false; |
3079 if (use_rtx) | 3158 if (use_rtx) |
3080 ssrc_is_rtx_[kSendRtxSsrcs[i]] = true; | 3159 ssrc_is_rtx_[kSendRtxSsrcs[i]] = true; |
3081 } | 3160 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3197 | 3276 |
3198 CreateSendConfig(kNumSsrcs, 0, &send_transport); | 3277 CreateSendConfig(kNumSsrcs, 0, &send_transport); |
3199 | 3278 |
3200 if (use_rtx) { | 3279 if (use_rtx) { |
3201 for (size_t i = 0; i < kNumSsrcs; ++i) { | 3280 for (size_t i = 0; i < kNumSsrcs; ++i) { |
3202 video_send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]); | 3281 video_send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]); |
3203 } | 3282 } |
3204 video_send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; | 3283 video_send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; |
3205 } | 3284 } |
3206 | 3285 |
3207 // Lower bitrates so that all streams send initially. | 3286 video_encoder_config_.video_stream_factory = |
3208 for (size_t i = 0; i < video_encoder_config_.streams.size(); ++i) { | 3287 new rtc::RefCountedObject<VideoStreamFactory>(); |
3209 video_encoder_config_.streams[i].min_bitrate_bps = 10000; | |
3210 video_encoder_config_.streams[i].target_bitrate_bps = 15000; | |
3211 video_encoder_config_.streams[i].max_bitrate_bps = 20000; | |
3212 } | |
3213 | |
3214 // Use the same total bitrates when sending a single stream to avoid lowering | 3288 // Use the same total bitrates when sending a single stream to avoid lowering |
3215 // the bitrate estimate and requiring a subsequent rampup. | 3289 // the bitrate estimate and requiring a subsequent rampup. |
3216 VideoEncoderConfig one_stream = video_encoder_config_.Copy(); | 3290 VideoEncoderConfig one_stream = video_encoder_config_.Copy(); |
3217 one_stream.streams.resize(1); | 3291 // one_stream.streams.resize(1); |
3218 for (size_t i = 1; i < video_encoder_config_.streams.size(); ++i) { | 3292 one_stream.number_of_streams = 1; |
3219 one_stream.streams.front().min_bitrate_bps += | |
3220 video_encoder_config_.streams[i].min_bitrate_bps; | |
3221 one_stream.streams.front().target_bitrate_bps += | |
3222 video_encoder_config_.streams[i].target_bitrate_bps; | |
3223 one_stream.streams.front().max_bitrate_bps += | |
3224 video_encoder_config_.streams[i].max_bitrate_bps; | |
3225 } | |
3226 | |
3227 CreateMatchingReceiveConfigs(&receive_transport); | 3293 CreateMatchingReceiveConfigs(&receive_transport); |
3228 | 3294 |
3229 CreateVideoStreams(); | 3295 CreateVideoStreams(); |
3230 CreateFrameGeneratorCapturer(); | 3296 CreateFrameGeneratorCapturer(30, 1280, 720); |
3231 | 3297 |
3232 Start(); | 3298 Start(); |
3233 EXPECT_TRUE(observer.Wait()) | 3299 EXPECT_TRUE(observer.Wait()) |
3234 << "Timed out waiting for all SSRCs to send packets."; | 3300 << "Timed out waiting for all SSRCs to send packets."; |
3235 | 3301 |
3236 // Test stream resetting more than once to make sure that the state doesn't | 3302 // Test stream resetting more than once to make sure that the state doesn't |
3237 // get set once (this could be due to using std::map::insert for instance). | 3303 // get set once (this could be due to using std::map::insert for instance). |
3238 for (size_t i = 0; i < 3; ++i) { | 3304 for (size_t i = 0; i < 3; ++i) { |
3239 frame_generator_capturer_->Stop(); | 3305 frame_generator_capturer_->Stop(); |
3240 sender_call_->DestroyVideoSendStream(video_send_stream_); | 3306 sender_call_->DestroyVideoSendStream(video_send_stream_); |
3241 | 3307 |
3242 // Re-create VideoSendStream with only one stream. | 3308 // Re-create VideoSendStream with only one stream. |
3243 video_send_stream_ = sender_call_->CreateVideoSendStream( | 3309 video_send_stream_ = sender_call_->CreateVideoSendStream( |
3244 video_send_config_.Copy(), one_stream.Copy()); | 3310 video_send_config_.Copy(), one_stream.Copy()); |
3245 video_send_stream_->Start(); | 3311 video_send_stream_->Start(); |
3246 if (provoke_rtcpsr_before_rtp) { | 3312 if (provoke_rtcpsr_before_rtp) { |
3247 // Rapid Resync Request forces sending RTCP Sender Report back. | 3313 // Rapid Resync Request forces sending RTCP Sender Report back. |
3248 // Using this request speeds up this test because then there is no need | 3314 // Using this request speeds up this test because then there is no need |
3249 // to wait for a second for periodic Sender Report. | 3315 // to wait for a second for periodic Sender Report. |
3250 rtcp::RapidResyncRequest force_send_sr_back_request; | 3316 rtcp::RapidResyncRequest force_send_sr_back_request; |
3251 rtc::Buffer packet = force_send_sr_back_request.Build(); | 3317 rtc::Buffer packet = force_send_sr_back_request.Build(); |
3252 static_cast<webrtc::test::DirectTransport&>(receive_transport) | 3318 static_cast<webrtc::test::DirectTransport&>(receive_transport) |
3253 .SendRtcp(packet.data(), packet.size()); | 3319 .SendRtcp(packet.data(), packet.size()); |
3254 } | 3320 } |
3255 CreateFrameGeneratorCapturer(); | 3321 CreateFrameGeneratorCapturer(30, 1280, 720); |
3256 frame_generator_capturer_->Start(); | 3322 frame_generator_capturer_->Start(); |
3257 | 3323 |
3258 observer.ResetExpectedSsrcs(1); | 3324 observer.ResetExpectedSsrcs(1); |
3259 EXPECT_TRUE(observer.Wait()) << "Timed out waiting for single RTP packet."; | 3325 EXPECT_TRUE(observer.Wait()) << "Timed out waiting for single RTP packet."; |
3260 | 3326 |
3261 // Reconfigure back to use all streams. | 3327 // Reconfigure back to use all streams. |
3262 video_send_stream_->ReconfigureVideoEncoder(video_encoder_config_.Copy()); | 3328 video_send_stream_->ReconfigureVideoEncoder(video_encoder_config_.Copy()); |
3263 observer.ResetExpectedSsrcs(kNumSsrcs); | 3329 observer.ResetExpectedSsrcs(kNumSsrcs); |
3264 EXPECT_TRUE(observer.Wait()) | 3330 EXPECT_TRUE(observer.Wait()) |
3265 << "Timed out waiting for all SSRCs to send packets."; | 3331 << "Timed out waiting for all SSRCs to send packets."; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3500 test::DirectTransport sender_transport(config, sender_call_.get()); | 3566 test::DirectTransport sender_transport(config, sender_call_.get()); |
3501 config.queue_delay_ms = kReceiveDelayMs; | 3567 config.queue_delay_ms = kReceiveDelayMs; |
3502 test::DirectTransport receiver_transport(config, receiver_call_.get()); | 3568 test::DirectTransport receiver_transport(config, receiver_call_.get()); |
3503 sender_transport.SetReceiver(receiver_call_->Receiver()); | 3569 sender_transport.SetReceiver(receiver_call_->Receiver()); |
3504 receiver_transport.SetReceiver(sender_call_->Receiver()); | 3570 receiver_transport.SetReceiver(sender_call_->Receiver()); |
3505 | 3571 |
3506 CreateSendConfig(1, 0, &sender_transport); | 3572 CreateSendConfig(1, 0, &sender_transport); |
3507 CreateMatchingReceiveConfigs(&receiver_transport); | 3573 CreateMatchingReceiveConfigs(&receiver_transport); |
3508 | 3574 |
3509 CreateVideoStreams(); | 3575 CreateVideoStreams(); |
3510 CreateFrameGeneratorCapturer(); | 3576 CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth, |
| 3577 kDefaultHeight); |
3511 Start(); | 3578 Start(); |
3512 | 3579 |
3513 int64_t start_time_ms = clock_->TimeInMilliseconds(); | 3580 int64_t start_time_ms = clock_->TimeInMilliseconds(); |
3514 while (true) { | 3581 while (true) { |
3515 Call::Stats stats = sender_call_->GetStats(); | 3582 Call::Stats stats = sender_call_->GetStats(); |
3516 ASSERT_GE(start_time_ms + kDefaultTimeoutMs, | 3583 ASSERT_GE(start_time_ms + kDefaultTimeoutMs, |
3517 clock_->TimeInMilliseconds()) | 3584 clock_->TimeInMilliseconds()) |
3518 << "No RTT stats before timeout!"; | 3585 << "No RTT stats before timeout!"; |
3519 if (stats.rtt_ms != -1) { | 3586 if (stats.rtt_ms != -1) { |
3520 // To avoid failures caused by rounding or minor ntp clock adjustments, | 3587 // To avoid failures caused by rounding or minor ntp clock adjustments, |
(...skipping 12 matching lines...) Expand all Loading... |
3533 void EndToEndTest::VerifyNewVideoSendStreamsRespectNetworkState( | 3600 void EndToEndTest::VerifyNewVideoSendStreamsRespectNetworkState( |
3534 MediaType network_to_bring_down, | 3601 MediaType network_to_bring_down, |
3535 VideoEncoder* encoder, | 3602 VideoEncoder* encoder, |
3536 Transport* transport) { | 3603 Transport* transport) { |
3537 CreateSenderCall(Call::Config()); | 3604 CreateSenderCall(Call::Config()); |
3538 sender_call_->SignalChannelNetworkState(network_to_bring_down, kNetworkDown); | 3605 sender_call_->SignalChannelNetworkState(network_to_bring_down, kNetworkDown); |
3539 | 3606 |
3540 CreateSendConfig(1, 0, transport); | 3607 CreateSendConfig(1, 0, transport); |
3541 video_send_config_.encoder_settings.encoder = encoder; | 3608 video_send_config_.encoder_settings.encoder = encoder; |
3542 CreateVideoStreams(); | 3609 CreateVideoStreams(); |
3543 CreateFrameGeneratorCapturer(); | 3610 CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth, |
| 3611 kDefaultHeight); |
3544 | 3612 |
3545 Start(); | 3613 Start(); |
3546 SleepMs(kSilenceTimeoutMs); | 3614 SleepMs(kSilenceTimeoutMs); |
3547 Stop(); | 3615 Stop(); |
3548 | 3616 |
3549 DestroyStreams(); | 3617 DestroyStreams(); |
3550 } | 3618 } |
3551 | 3619 |
3552 void EndToEndTest::VerifyNewVideoReceiveStreamsRespectNetworkState( | 3620 void EndToEndTest::VerifyNewVideoReceiveStreamsRespectNetworkState( |
3553 MediaType network_to_bring_down, | 3621 MediaType network_to_bring_down, |
3554 Transport* transport) { | 3622 Transport* transport) { |
3555 CreateCalls(Call::Config(), Call::Config()); | 3623 CreateCalls(Call::Config(), Call::Config()); |
3556 receiver_call_->SignalChannelNetworkState(network_to_bring_down, | 3624 receiver_call_->SignalChannelNetworkState(network_to_bring_down, |
3557 kNetworkDown); | 3625 kNetworkDown); |
3558 | 3626 |
3559 test::DirectTransport sender_transport(sender_call_.get()); | 3627 test::DirectTransport sender_transport(sender_call_.get()); |
3560 sender_transport.SetReceiver(receiver_call_->Receiver()); | 3628 sender_transport.SetReceiver(receiver_call_->Receiver()); |
3561 CreateSendConfig(1, 0, &sender_transport); | 3629 CreateSendConfig(1, 0, &sender_transport); |
3562 CreateMatchingReceiveConfigs(transport); | 3630 CreateMatchingReceiveConfigs(transport); |
3563 CreateVideoStreams(); | 3631 CreateVideoStreams(); |
3564 CreateFrameGeneratorCapturer(); | 3632 CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth, |
| 3633 kDefaultHeight); |
3565 | 3634 |
3566 Start(); | 3635 Start(); |
3567 SleepMs(kSilenceTimeoutMs); | 3636 SleepMs(kSilenceTimeoutMs); |
3568 Stop(); | 3637 Stop(); |
3569 | 3638 |
3570 sender_transport.StopSending(); | 3639 sender_transport.StopSending(); |
3571 | 3640 |
3572 DestroyStreams(); | 3641 DestroyStreams(); |
3573 } | 3642 } |
3574 | 3643 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3747 private: | 3816 private: |
3748 bool video_observed_; | 3817 bool video_observed_; |
3749 bool audio_observed_; | 3818 bool audio_observed_; |
3750 SequenceNumberUnwrapper unwrapper_; | 3819 SequenceNumberUnwrapper unwrapper_; |
3751 std::set<int64_t> received_packet_ids_; | 3820 std::set<int64_t> received_packet_ids_; |
3752 } test; | 3821 } test; |
3753 | 3822 |
3754 RunBaseTest(&test); | 3823 RunBaseTest(&test); |
3755 } | 3824 } |
3756 } // namespace webrtc | 3825 } // namespace webrtc |
OLD | NEW |