OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 } | 1090 } |
1091 | 1091 |
1092 void TestCpuAdaptation(bool enable_overuse, bool is_screenshare); | 1092 void TestCpuAdaptation(bool enable_overuse, bool is_screenshare); |
1093 void TestReceiverLocalSsrcConfiguration(bool receiver_first); | 1093 void TestReceiverLocalSsrcConfiguration(bool receiver_first); |
1094 void TestReceiveUnsignalledSsrcPacket(uint8_t payload_type, | 1094 void TestReceiveUnsignalledSsrcPacket(uint8_t payload_type, |
1095 bool expect_created_receive_stream); | 1095 bool expect_created_receive_stream); |
1096 | 1096 |
1097 FakeVideoSendStream* SetDenoisingOption( | 1097 FakeVideoSendStream* SetDenoisingOption( |
1098 const cricket::VideoSendParameters& parameters, bool enabled) { | 1098 const cricket::VideoSendParameters& parameters, bool enabled) { |
1099 cricket::VideoSendParameters params = parameters; | 1099 cricket::VideoSendParameters params = parameters; |
1100 params.options.video_noise_reduction.Set(enabled); | 1100 params.options.video_noise_reduction = rtc::Maybe<bool>(enabled); |
1101 channel_->SetSendParameters(params); | 1101 channel_->SetSendParameters(params); |
1102 return fake_call_->GetVideoSendStreams().back(); | 1102 return fake_call_->GetVideoSendStreams().back(); |
1103 } | 1103 } |
1104 | 1104 |
1105 FakeVideoSendStream* SetUpSimulcast(bool enabled, bool with_rtx) { | 1105 FakeVideoSendStream* SetUpSimulcast(bool enabled, bool with_rtx) { |
1106 const int kRtxSsrcOffset = 0xDEADBEEF; | 1106 const int kRtxSsrcOffset = 0xDEADBEEF; |
1107 last_ssrc_ += 3; | 1107 last_ssrc_ += 3; |
1108 std::vector<uint32_t> ssrcs; | 1108 std::vector<uint32_t> ssrcs; |
1109 std::vector<uint32_t> rtx_ssrcs; | 1109 std::vector<uint32_t> rtx_ssrcs; |
1110 uint32_t num_streams = enabled ? 3 : 1; | 1110 uint32_t num_streams = enabled ? 3 : 1; |
(...skipping 30 matching lines...) Expand all Loading... |
1141 EXPECT_EQ(kSyncLabel, | 1141 EXPECT_EQ(kSyncLabel, |
1142 fake_call_->GetVideoReceiveStreams()[0]->GetConfig().sync_group) | 1142 fake_call_->GetVideoReceiveStreams()[0]->GetConfig().sync_group) |
1143 << "SyncGroup should be set based on sync_label"; | 1143 << "SyncGroup should be set based on sync_label"; |
1144 } | 1144 } |
1145 | 1145 |
1146 TEST_F(WebRtcVideoChannel2Test, RecvStreamWithSimAndRtx) { | 1146 TEST_F(WebRtcVideoChannel2Test, RecvStreamWithSimAndRtx) { |
1147 cricket::VideoSendParameters parameters; | 1147 cricket::VideoSendParameters parameters; |
1148 parameters.codecs = engine_.codecs(); | 1148 parameters.codecs = engine_.codecs(); |
1149 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 1149 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
1150 EXPECT_TRUE(channel_->SetSend(true)); | 1150 EXPECT_TRUE(channel_->SetSend(true)); |
1151 parameters.options.conference_mode.Set(true); | 1151 parameters.options.conference_mode = rtc::Maybe<bool>(true); |
1152 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 1152 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
1153 | 1153 |
1154 // Send side. | 1154 // Send side. |
1155 const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1); | 1155 const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1); |
1156 const std::vector<uint32_t> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); | 1156 const std::vector<uint32_t> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
1157 FakeVideoSendStream* send_stream = AddSendStream( | 1157 FakeVideoSendStream* send_stream = AddSendStream( |
1158 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); | 1158 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
1159 | 1159 |
1160 ASSERT_EQ(rtx_ssrcs.size(), send_stream->GetConfig().rtp.rtx.ssrcs.size()); | 1160 ASSERT_EQ(rtx_ssrcs.size(), send_stream->GetConfig().rtp.rtx.ssrcs.size()); |
1161 for (size_t i = 0; i < rtx_ssrcs.size(); ++i) | 1161 for (size_t i = 0; i < rtx_ssrcs.size(); ++i) |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 | 1551 |
1552 TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthInConference) { | 1552 TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthInConference) { |
1553 FAIL() << "Not implemented."; // TODO(pbos): Implement. | 1553 FAIL() << "Not implemented."; // TODO(pbos): Implement. |
1554 } | 1554 } |
1555 | 1555 |
1556 TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) { | 1556 TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) { |
1557 static const int kScreenshareMinBitrateKbps = 800; | 1557 static const int kScreenshareMinBitrateKbps = 800; |
1558 cricket::VideoCodec codec = kVp8Codec360p; | 1558 cricket::VideoCodec codec = kVp8Codec360p; |
1559 cricket::VideoSendParameters parameters; | 1559 cricket::VideoSendParameters parameters; |
1560 parameters.codecs.push_back(codec); | 1560 parameters.codecs.push_back(codec); |
1561 parameters.options.screencast_min_bitrate.Set(kScreenshareMinBitrateKbps); | 1561 parameters.options.screencast_min_bitrate = |
| 1562 rtc::Maybe<int>(kScreenshareMinBitrateKbps); |
1562 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 1563 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
1563 | 1564 |
1564 AddSendStream(); | 1565 AddSendStream(); |
1565 | 1566 |
1566 cricket::FakeVideoCapturer capturer; | 1567 cricket::FakeVideoCapturer capturer; |
1567 capturer.SetScreencast(false); | 1568 capturer.SetScreencast(false); |
1568 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); | 1569 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); |
1569 cricket::VideoFormat capture_format_hd = | 1570 cricket::VideoFormat capture_format_hd = |
1570 capturer.GetSupportedFormats()->front(); | 1571 capturer.GetSupportedFormats()->front(); |
1571 EXPECT_EQ(1280, capture_format_hd.width); | 1572 EXPECT_EQ(1280, capture_format_hd.width); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 EXPECT_EQ(capture_format_hd.height, encoder_config.streams.front().height); | 1606 EXPECT_EQ(capture_format_hd.height, encoder_config.streams.front().height); |
1606 EXPECT_TRUE(encoder_config.streams[0].temporal_layer_thresholds_bps.empty()); | 1607 EXPECT_TRUE(encoder_config.streams[0].temporal_layer_thresholds_bps.empty()); |
1607 | 1608 |
1608 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL)); | 1609 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL)); |
1609 } | 1610 } |
1610 | 1611 |
1611 TEST_F(WebRtcVideoChannel2Test, | 1612 TEST_F(WebRtcVideoChannel2Test, |
1612 ConferenceModeScreencastConfiguresTemporalLayer) { | 1613 ConferenceModeScreencastConfiguresTemporalLayer) { |
1613 static const int kConferenceScreencastTemporalBitrateBps = | 1614 static const int kConferenceScreencastTemporalBitrateBps = |
1614 ScreenshareLayerConfig::GetDefault().tl0_bitrate_kbps * 1000; | 1615 ScreenshareLayerConfig::GetDefault().tl0_bitrate_kbps * 1000; |
1615 send_parameters_.options.conference_mode.Set(true); | 1616 send_parameters_.options.conference_mode = rtc::Maybe<bool>(true); |
1616 channel_->SetSendParameters(send_parameters_); | 1617 channel_->SetSendParameters(send_parameters_); |
1617 | 1618 |
1618 AddSendStream(); | 1619 AddSendStream(); |
1619 | 1620 |
1620 cricket::FakeVideoCapturer capturer; | 1621 cricket::FakeVideoCapturer capturer; |
1621 capturer.SetScreencast(true); | 1622 capturer.SetScreencast(true); |
1622 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); | 1623 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); |
1623 cricket::VideoFormat capture_format_hd = | 1624 cricket::VideoFormat capture_format_hd = |
1624 capturer.GetSupportedFormats()->front(); | 1625 capturer.GetSupportedFormats()->front(); |
1625 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd)); | 1626 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd)); |
(...skipping 26 matching lines...) Expand all Loading... |
1652 DISABLED_SetSendSsrcAfterCreatingReceiveChannel) { | 1653 DISABLED_SetSendSsrcAfterCreatingReceiveChannel) { |
1653 FAIL() << "Not implemented."; // TODO(pbos): Implement. | 1654 FAIL() << "Not implemented."; // TODO(pbos): Implement. |
1654 } | 1655 } |
1655 | 1656 |
1656 TEST_F(WebRtcVideoChannel2Test, SuspendBelowMinBitrateDisabledByDefault) { | 1657 TEST_F(WebRtcVideoChannel2Test, SuspendBelowMinBitrateDisabledByDefault) { |
1657 FakeVideoSendStream* stream = AddSendStream(); | 1658 FakeVideoSendStream* stream = AddSendStream(); |
1658 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); | 1659 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); |
1659 } | 1660 } |
1660 | 1661 |
1661 TEST_F(WebRtcVideoChannel2Test, SetOptionsWithSuspendBelowMinBitrate) { | 1662 TEST_F(WebRtcVideoChannel2Test, SetOptionsWithSuspendBelowMinBitrate) { |
1662 send_parameters_.options.suspend_below_min_bitrate.Set(true); | 1663 send_parameters_.options.suspend_below_min_bitrate = rtc::Maybe<bool>(true); |
1663 channel_->SetSendParameters(send_parameters_); | 1664 channel_->SetSendParameters(send_parameters_); |
1664 | 1665 |
1665 FakeVideoSendStream* stream = AddSendStream(); | 1666 FakeVideoSendStream* stream = AddSendStream(); |
1666 EXPECT_TRUE(stream->GetConfig().suspend_below_min_bitrate); | 1667 EXPECT_TRUE(stream->GetConfig().suspend_below_min_bitrate); |
1667 | 1668 |
1668 send_parameters_.options.suspend_below_min_bitrate.Set(false); | 1669 send_parameters_.options.suspend_below_min_bitrate = rtc::Maybe<bool>(false); |
1669 channel_->SetSendParameters(send_parameters_); | 1670 channel_->SetSendParameters(send_parameters_); |
1670 | 1671 |
1671 stream = fake_call_->GetVideoSendStreams()[0]; | 1672 stream = fake_call_->GetVideoSendStreams()[0]; |
1672 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); | 1673 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); |
1673 } | 1674 } |
1674 | 1675 |
1675 TEST_F(WebRtcVideoChannel2Test, Vp8DenoisingEnabledByDefault) { | 1676 TEST_F(WebRtcVideoChannel2Test, Vp8DenoisingEnabledByDefault) { |
1676 FakeVideoSendStream* stream = AddSendStream(); | 1677 FakeVideoSendStream* stream = AddSendStream(); |
1677 webrtc::VideoCodecVP8 vp8_settings; | 1678 webrtc::VideoCodecVP8 vp8_settings; |
1678 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; | 1679 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 TEST_F(WebRtcVideoChannel2Test, DoesNotAdaptOnOveruseWhenScreensharing) { | 1847 TEST_F(WebRtcVideoChannel2Test, DoesNotAdaptOnOveruseWhenScreensharing) { |
1847 TestCpuAdaptation(true, true); | 1848 TestCpuAdaptation(true, true); |
1848 } | 1849 } |
1849 | 1850 |
1850 void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse, | 1851 void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse, |
1851 bool is_screenshare) { | 1852 bool is_screenshare) { |
1852 cricket::VideoCodec codec = kVp8Codec720p; | 1853 cricket::VideoCodec codec = kVp8Codec720p; |
1853 cricket::VideoSendParameters parameters; | 1854 cricket::VideoSendParameters parameters; |
1854 parameters.codecs.push_back(codec); | 1855 parameters.codecs.push_back(codec); |
1855 if (!enable_overuse) { | 1856 if (!enable_overuse) { |
1856 parameters.options.cpu_overuse_detection.Set(false); | 1857 parameters.options.cpu_overuse_detection = rtc::Maybe<bool>(false); |
1857 } | 1858 } |
1858 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 1859 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
1859 | 1860 |
1860 AddSendStream(); | 1861 AddSendStream(); |
1861 | 1862 |
1862 cricket::FakeVideoCapturer capturer; | 1863 cricket::FakeVideoCapturer capturer; |
1863 capturer.SetScreencast(is_screenshare); | 1864 capturer.SetScreencast(is_screenshare); |
1864 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); | 1865 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); |
1865 EXPECT_EQ(cricket::CS_RUNNING, | 1866 EXPECT_EQ(cricket::CS_RUNNING, |
1866 capturer.Start(capturer.GetSupportedFormats()->front())); | 1867 capturer.Start(capturer.GetSupportedFormats()->front())); |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2368 } | 2369 } |
2369 | 2370 |
2370 // This test verifies DSCP settings are properly applied on video media channel. | 2371 // This test verifies DSCP settings are properly applied on video media channel. |
2371 TEST_F(WebRtcVideoChannel2Test, TestSetDscpOptions) { | 2372 TEST_F(WebRtcVideoChannel2Test, TestSetDscpOptions) { |
2372 rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface( | 2373 rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface( |
2373 new cricket::FakeNetworkInterface); | 2374 new cricket::FakeNetworkInterface); |
2374 channel_->SetInterface(network_interface.get()); | 2375 channel_->SetInterface(network_interface.get()); |
2375 cricket::VideoSendParameters parameters = send_parameters_; | 2376 cricket::VideoSendParameters parameters = send_parameters_; |
2376 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 2377 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
2377 EXPECT_EQ(rtc::DSCP_NO_CHANGE, network_interface->dscp()); | 2378 EXPECT_EQ(rtc::DSCP_NO_CHANGE, network_interface->dscp()); |
2378 parameters.options.dscp.Set(true); | 2379 parameters.options.dscp = rtc::Maybe<bool>(true); |
2379 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 2380 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
2380 EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp()); | 2381 EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp()); |
2381 // Verify previous value is not modified if dscp option is not set. | 2382 // Verify previous value is not modified if dscp option is not set. |
2382 cricket::VideoSendParameters parameters1 = send_parameters_; | 2383 cricket::VideoSendParameters parameters1 = send_parameters_; |
2383 EXPECT_TRUE(channel_->SetSendParameters(parameters1)); | 2384 EXPECT_TRUE(channel_->SetSendParameters(parameters1)); |
2384 EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp()); | 2385 EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp()); |
2385 parameters1.options.dscp.Set(false); | 2386 parameters1.options.dscp = rtc::Maybe<bool>(false); |
2386 EXPECT_TRUE(channel_->SetSendParameters(parameters1)); | 2387 EXPECT_TRUE(channel_->SetSendParameters(parameters1)); |
2387 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp()); | 2388 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp()); |
2388 channel_->SetInterface(NULL); | 2389 channel_->SetInterface(NULL); |
2389 } | 2390 } |
2390 | 2391 |
2391 TEST_F(WebRtcVideoChannel2Test, OnReadyToSendSignalsNetworkState) { | 2392 TEST_F(WebRtcVideoChannel2Test, OnReadyToSendSignalsNetworkState) { |
2392 EXPECT_EQ(webrtc::kNetworkUp, fake_call_->GetNetworkState()); | 2393 EXPECT_EQ(webrtc::kNetworkUp, fake_call_->GetNetworkState()); |
2393 | 2394 |
2394 channel_->OnReadyToSend(false); | 2395 channel_->OnReadyToSend(false); |
2395 EXPECT_EQ(webrtc::kNetworkDown, fake_call_->GetNetworkState()); | 2396 EXPECT_EQ(webrtc::kNetworkDown, fake_call_->GetNetworkState()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2453 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], &video_capturer_vga)); | 2454 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], &video_capturer_vga)); |
2454 EXPECT_TRUE(video_capturer_vga.CaptureFrame()); | 2455 EXPECT_TRUE(video_capturer_vga.CaptureFrame()); |
2455 | 2456 |
2456 cricket::VideoCodec send_codec(100, "VP8", 640, 480, 30, 0); | 2457 cricket::VideoCodec send_codec(100, "VP8", 640, 480, 30, 0); |
2457 cricket::VideoSendParameters parameters; | 2458 cricket::VideoSendParameters parameters; |
2458 parameters.codecs.push_back(send_codec); | 2459 parameters.codecs.push_back(send_codec); |
2459 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 2460 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
2460 EXPECT_TRUE(channel_->SetSend(true)); | 2461 EXPECT_TRUE(channel_->SetSend(true)); |
2461 | 2462 |
2462 // Verify that the CpuOveruseObserver is registered and trigger downgrade. | 2463 // Verify that the CpuOveruseObserver is registered and trigger downgrade. |
2463 parameters.options.cpu_overuse_detection.Set(true); | 2464 parameters.options.cpu_overuse_detection = rtc::Maybe<bool>(true); |
2464 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 2465 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
2465 | 2466 |
2466 // Trigger overuse. | 2467 // Trigger overuse. |
2467 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); | 2468 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); |
2468 webrtc::LoadObserver* overuse_callback = | 2469 webrtc::LoadObserver* overuse_callback = |
2469 fake_call_->GetVideoSendStreams().front()->GetConfig().overuse_callback; | 2470 fake_call_->GetVideoSendStreams().front()->GetConfig().overuse_callback; |
2470 ASSERT_TRUE(overuse_callback != NULL); | 2471 ASSERT_TRUE(overuse_callback != NULL); |
2471 overuse_callback->OnLoadUpdate(webrtc::LoadObserver::kOveruse); | 2472 overuse_callback->OnLoadUpdate(webrtc::LoadObserver::kOveruse); |
2472 | 2473 |
2473 // Capture format VGA -> adapt (OnCpuResolutionRequest downgrade) -> VGA/2. | 2474 // Capture format VGA -> adapt (OnCpuResolutionRequest downgrade) -> VGA/2. |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3271 // Ensures that the correct settings are applied to the codec when two temporal | 3272 // Ensures that the correct settings are applied to the codec when two temporal |
3272 // layer screencasting is enabled, and that the correct simulcast settings are | 3273 // layer screencasting is enabled, and that the correct simulcast settings are |
3273 // reapplied when disabling screencasting. | 3274 // reapplied when disabling screencasting. |
3274 TEST_F(WebRtcVideoChannel2SimulcastTest, | 3275 TEST_F(WebRtcVideoChannel2SimulcastTest, |
3275 DISABLED_TwoTemporalLayerScreencastSettings) { | 3276 DISABLED_TwoTemporalLayerScreencastSettings) { |
3276 // TODO(pbos): Implement. | 3277 // TODO(pbos): Implement. |
3277 FAIL() << "Not implemented."; | 3278 FAIL() << "Not implemented."; |
3278 } | 3279 } |
3279 | 3280 |
3280 } // namespace cricket | 3281 } // namespace cricket |
OLD | NEW |