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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 1711763003: New flag is_screencast in VideoOptions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix OnLoadUpdate is_screencast check. Don't set FakeVideoCapturer into screencast mode in the video… Created 4 years, 9 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/media/engine/webrtcvideoengine2.cc ('k') | webrtc/video/video_send_stream.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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 10
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 cricket::VideoCodec codec = kVp8Codec360p; 1465 cricket::VideoCodec codec = kVp8Codec360p;
1466 cricket::VideoSendParameters parameters; 1466 cricket::VideoSendParameters parameters;
1467 parameters.codecs.push_back(codec); 1467 parameters.codecs.push_back(codec);
1468 parameters.options.screencast_min_bitrate_kbps = 1468 parameters.options.screencast_min_bitrate_kbps =
1469 rtc::Optional<int>(kScreenshareMinBitrateKbps); 1469 rtc::Optional<int>(kScreenshareMinBitrateKbps);
1470 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1470 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1471 1471
1472 AddSendStream(); 1472 AddSendStream();
1473 1473
1474 cricket::FakeVideoCapturer capturer; 1474 cricket::FakeVideoCapturer capturer;
1475 capturer.SetScreencast(false);
1476 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1475 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1477 cricket::VideoFormat capture_format_hd = 1476 cricket::VideoFormat capture_format_hd =
1478 capturer.GetSupportedFormats()->front(); 1477 capturer.GetSupportedFormats()->front();
1479 EXPECT_EQ(1280, capture_format_hd.width); 1478 EXPECT_EQ(1280, capture_format_hd.width);
1480 EXPECT_EQ(720, capture_format_hd.height); 1479 EXPECT_EQ(720, capture_format_hd.height);
1481 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd)); 1480 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd));
1482 1481
1483 EXPECT_TRUE(channel_->SetSend(true)); 1482 EXPECT_TRUE(channel_->SetSend(true));
1484 1483
1485 EXPECT_TRUE(capturer.CaptureFrame()); 1484 EXPECT_TRUE(capturer.CaptureFrame());
1486 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); 1485 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size());
1487 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front(); 1486 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front();
1488 1487
1489 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); 1488 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames());
1490 1489
1491 // Verify non-screencast settings. 1490 // Verify non-screencast settings.
1492 webrtc::VideoEncoderConfig encoder_config = send_stream->GetEncoderConfig(); 1491 webrtc::VideoEncoderConfig encoder_config = send_stream->GetEncoderConfig();
1493 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo, 1492 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo,
1494 encoder_config.content_type); 1493 encoder_config.content_type);
1495 EXPECT_EQ(codec.width, encoder_config.streams.front().width); 1494 EXPECT_EQ(codec.width, encoder_config.streams.front().width);
1496 EXPECT_EQ(codec.height, encoder_config.streams.front().height); 1495 EXPECT_EQ(codec.height, encoder_config.streams.front().height);
1497 EXPECT_EQ(0, encoder_config.min_transmit_bitrate_bps) 1496 EXPECT_EQ(0, encoder_config.min_transmit_bitrate_bps)
1498 << "Non-screenshare shouldn't use min-transmit bitrate."; 1497 << "Non-screenshare shouldn't use min-transmit bitrate.";
1499 1498
1500 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, nullptr)); 1499 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, nullptr));
1501 // Removing a capturer triggers a black frame to be sent. 1500 // Removing a capturer triggers a black frame to be sent.
1502 EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames()); 1501 EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames());
1503 capturer.SetScreencast(true);
1504 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1502 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1503 parameters.options.is_screencast = rtc::Optional<bool>(true);
1504 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1505 EXPECT_TRUE(capturer.CaptureFrame()); 1505 EXPECT_TRUE(capturer.CaptureFrame());
1506 // Send stream not recreated after option change.
1507 ASSERT_EQ(send_stream, fake_call_->GetVideoSendStreams().front());
1506 EXPECT_EQ(3, send_stream->GetNumberOfSwappedFrames()); 1508 EXPECT_EQ(3, send_stream->GetNumberOfSwappedFrames());
1507 1509
1508 // Verify screencast settings. 1510 // Verify screencast settings.
1509 encoder_config = send_stream->GetEncoderConfig(); 1511 encoder_config = send_stream->GetEncoderConfig();
1510 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kScreen, 1512 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kScreen,
1511 encoder_config.content_type); 1513 encoder_config.content_type);
1512 EXPECT_EQ(kScreenshareMinBitrateKbps * 1000, 1514 EXPECT_EQ(kScreenshareMinBitrateKbps * 1000,
1513 encoder_config.min_transmit_bitrate_bps); 1515 encoder_config.min_transmit_bitrate_bps);
1514 1516
1515 EXPECT_EQ(capture_format_hd.width, encoder_config.streams.front().width); 1517 EXPECT_EQ(capture_format_hd.width, encoder_config.streams.front().width);
1516 EXPECT_EQ(capture_format_hd.height, encoder_config.streams.front().height); 1518 EXPECT_EQ(capture_format_hd.height, encoder_config.streams.front().height);
1517 EXPECT_TRUE(encoder_config.streams[0].temporal_layer_thresholds_bps.empty()); 1519 EXPECT_TRUE(encoder_config.streams[0].temporal_layer_thresholds_bps.empty());
1518 1520
1519 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL)); 1521 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
1520 } 1522 }
1521 1523
1524 TEST_F(WebRtcVideoChannel2Test, NoRecreateStreamForScreencast) {
1525 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
1526 ASSERT_TRUE(
1527 channel_->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc)));
1528 EXPECT_TRUE(channel_->SetSend(true));
1529
1530 cricket::FakeVideoCapturer capturer;
1531 EXPECT_TRUE(channel_->SetCapturer(kSsrc, &capturer));
1532 EXPECT_EQ(cricket::CS_RUNNING,
1533 capturer.Start(capturer.GetSupportedFormats()->front()));
1534 EXPECT_TRUE(capturer.CaptureFrame());
1535
1536 ASSERT_EQ(1, fake_call_->GetNumCreatedSendStreams());
1537 FakeVideoSendStream* stream = fake_call_->GetVideoSendStreams().front();
1538 webrtc::VideoEncoderConfig encoder_config = stream->GetEncoderConfig();
1539 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo,
1540 encoder_config.content_type);
1541
1542 EXPECT_EQ(1, stream->GetNumberOfSwappedFrames());
1543
1544 /* Switch to screencast source. We expect a reconfigure of the
1545 * encoder, but no change of the send stream. */
1546 struct VideoOptions video_options;
1547 video_options.is_screencast = rtc::Optional<bool>(true);
1548 channel_->SetVideoSend(kSsrc, true, &video_options);
1549
1550 EXPECT_TRUE(capturer.CaptureFrame());
1551 ASSERT_EQ(1, fake_call_->GetNumCreatedSendStreams());
1552 ASSERT_EQ(stream, fake_call_->GetVideoSendStreams().front());
1553 EXPECT_EQ(2, stream->GetNumberOfSwappedFrames());
1554
1555 encoder_config = stream->GetEncoderConfig();
1556 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kScreen,
1557 encoder_config.content_type);
1558
1559 /* Switch back. */
1560 video_options.is_screencast = rtc::Optional<bool>(false);
1561 channel_->SetVideoSend(kSsrc, true, &video_options);
1562
1563 EXPECT_TRUE(capturer.CaptureFrame());
1564 ASSERT_EQ(1, fake_call_->GetNumCreatedSendStreams());
1565 ASSERT_EQ(stream, fake_call_->GetVideoSendStreams().front());
1566 EXPECT_EQ(3, stream->GetNumberOfSwappedFrames());
1567
1568 encoder_config = stream->GetEncoderConfig();
1569 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo,
1570 encoder_config.content_type);
1571
1572 EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL));
1573 }
1574
1522 TEST_F(WebRtcVideoChannel2Test, 1575 TEST_F(WebRtcVideoChannel2Test,
1523 ConferenceModeScreencastConfiguresTemporalLayer) { 1576 ConferenceModeScreencastConfiguresTemporalLayer) {
1524 static const int kConferenceScreencastTemporalBitrateBps = 1577 static const int kConferenceScreencastTemporalBitrateBps =
1525 ScreenshareLayerConfig::GetDefault().tl0_bitrate_kbps * 1000; 1578 ScreenshareLayerConfig::GetDefault().tl0_bitrate_kbps * 1000;
1526 send_parameters_.conference_mode = true; 1579 send_parameters_.conference_mode = true;
1580 send_parameters_.options.is_screencast = rtc::Optional<bool>(true);
1527 channel_->SetSendParameters(send_parameters_); 1581 channel_->SetSendParameters(send_parameters_);
1528 1582
1529 AddSendStream(); 1583 AddSendStream();
1530 1584
1531 cricket::FakeVideoCapturer capturer; 1585 cricket::FakeVideoCapturer capturer;
1532 capturer.SetScreencast(true);
1533 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1586 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1534 cricket::VideoFormat capture_format_hd = 1587 cricket::VideoFormat capture_format_hd =
1535 capturer.GetSupportedFormats()->front(); 1588 capturer.GetSupportedFormats()->front();
1536 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd)); 1589 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd));
1537 1590
1538 EXPECT_TRUE(channel_->SetSend(true)); 1591 EXPECT_TRUE(channel_->SetSend(true));
1539 1592
1540 EXPECT_TRUE(capturer.CaptureFrame()); 1593 EXPECT_TRUE(capturer.CaptureFrame());
1541 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); 1594 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size());
1542 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front(); 1595 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 cricket::VideoSendParameters parameters; 1646 cricket::VideoSendParameters parameters;
1594 parameters.codecs.push_back(kVp8Codec720p); 1647 parameters.codecs.push_back(kVp8Codec720p);
1595 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 1648 ASSERT_TRUE(channel_->SetSendParameters(parameters));
1596 1649
1597 // Single-stream settings should apply with RTX as well (verifies that we 1650 // Single-stream settings should apply with RTX as well (verifies that we
1598 // check number of regular SSRCs and not StreamParams::ssrcs which contains 1651 // check number of regular SSRCs and not StreamParams::ssrcs which contains
1599 // both RTX and regular SSRCs). 1652 // both RTX and regular SSRCs).
1600 FakeVideoSendStream* stream = SetUpSimulcast(false, true); 1653 FakeVideoSendStream* stream = SetUpSimulcast(false, true);
1601 1654
1602 cricket::FakeVideoCapturer capturer; 1655 cricket::FakeVideoCapturer capturer;
1603 capturer.SetScreencast(false);
1604 EXPECT_EQ(cricket::CS_RUNNING, 1656 EXPECT_EQ(cricket::CS_RUNNING,
1605 capturer.Start(capturer.GetSupportedFormats()->front())); 1657 capturer.Start(capturer.GetSupportedFormats()->front()));
1606 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1658 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1607 channel_->SetSend(true); 1659 channel_->SetSend(true);
1608 1660
1609 EXPECT_TRUE(capturer.CaptureFrame()); 1661 EXPECT_TRUE(capturer.CaptureFrame());
1610 1662
1611 webrtc::VideoCodecVP8 vp8_settings; 1663 webrtc::VideoCodecVP8 vp8_settings;
1612 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; 1664 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
1613 EXPECT_TRUE(vp8_settings.denoisingOn) 1665 EXPECT_TRUE(vp8_settings.denoisingOn)
(...skipping 19 matching lines...) Expand all
1633 channel_->SetSend(true); 1685 channel_->SetSend(true);
1634 EXPECT_TRUE(capturer.CaptureFrame()); 1686 EXPECT_TRUE(capturer.CaptureFrame());
1635 1687
1636 EXPECT_EQ(3, stream->GetVideoStreams().size()); 1688 EXPECT_EQ(3, stream->GetVideoStreams().size());
1637 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; 1689 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
1638 // Autmatic resize off when using simulcast. 1690 // Autmatic resize off when using simulcast.
1639 EXPECT_FALSE(vp8_settings.automaticResizeOn); 1691 EXPECT_FALSE(vp8_settings.automaticResizeOn);
1640 EXPECT_TRUE(vp8_settings.frameDroppingOn); 1692 EXPECT_TRUE(vp8_settings.frameDroppingOn);
1641 1693
1642 // In screen-share mode, denoising is forced off and simulcast disabled. 1694 // In screen-share mode, denoising is forced off and simulcast disabled.
1643 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL)); 1695 parameters.options.is_screencast = rtc::Optional<bool>(true);
1644 capturer.SetScreencast(true); 1696 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1645 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1697
1646 EXPECT_TRUE(capturer.CaptureFrame());
1647 stream = SetDenoisingOption(parameters, &capturer, false); 1698 stream = SetDenoisingOption(parameters, &capturer, false);
1648 1699
1649 EXPECT_EQ(1, stream->GetVideoStreams().size()); 1700 EXPECT_EQ(1, stream->GetVideoStreams().size());
1650 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; 1701 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
1651 EXPECT_FALSE(vp8_settings.denoisingOn); 1702 EXPECT_FALSE(vp8_settings.denoisingOn);
1652 // Resizing and frame dropping always off for screen sharing. 1703 // Resizing and frame dropping always off for screen sharing.
1653 EXPECT_FALSE(vp8_settings.automaticResizeOn); 1704 EXPECT_FALSE(vp8_settings.automaticResizeOn);
1654 EXPECT_FALSE(vp8_settings.frameDroppingOn); 1705 EXPECT_FALSE(vp8_settings.frameDroppingOn);
1655 1706
1656 stream = SetDenoisingOption(parameters, &capturer, true); 1707 stream = SetDenoisingOption(parameters, &capturer, true);
(...skipping 30 matching lines...) Expand all
1687 }; 1738 };
1688 1739
1689 TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) { 1740 TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) {
1690 cricket::VideoSendParameters parameters; 1741 cricket::VideoSendParameters parameters;
1691 parameters.codecs.push_back(kVp9Codec); 1742 parameters.codecs.push_back(kVp9Codec);
1692 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 1743 ASSERT_TRUE(channel_->SetSendParameters(parameters));
1693 1744
1694 FakeVideoSendStream* stream = SetUpSimulcast(false, false); 1745 FakeVideoSendStream* stream = SetUpSimulcast(false, false);
1695 1746
1696 cricket::FakeVideoCapturer capturer; 1747 cricket::FakeVideoCapturer capturer;
1697 capturer.SetScreencast(false);
1698 EXPECT_EQ(cricket::CS_RUNNING, 1748 EXPECT_EQ(cricket::CS_RUNNING,
1699 capturer.Start(capturer.GetSupportedFormats()->front())); 1749 capturer.Start(capturer.GetSupportedFormats()->front()));
1700 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1750 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1701 channel_->SetSend(true); 1751 channel_->SetSend(true);
1702 1752
1703 EXPECT_TRUE(capturer.CaptureFrame()); 1753 EXPECT_TRUE(capturer.CaptureFrame());
1704 1754
1705 webrtc::VideoCodecVP9 vp9_settings; 1755 webrtc::VideoCodecVP9 vp9_settings;
1706 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set."; 1756 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
1707 EXPECT_FALSE(vp9_settings.denoisingOn) 1757 EXPECT_FALSE(vp9_settings.denoisingOn)
1708 << "VP9 denoising should be off by default."; 1758 << "VP9 denoising should be off by default.";
1709 1759
1710 stream = SetDenoisingOption(parameters, &capturer, false); 1760 stream = SetDenoisingOption(parameters, &capturer, false);
1711 1761
1712 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set."; 1762 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
1713 EXPECT_FALSE(vp9_settings.denoisingOn); 1763 EXPECT_FALSE(vp9_settings.denoisingOn);
1714 // Frame dropping always on for real time video. 1764 // Frame dropping always on for real time video.
1715 EXPECT_TRUE(vp9_settings.frameDroppingOn); 1765 EXPECT_TRUE(vp9_settings.frameDroppingOn);
1716 1766
1717 stream = SetDenoisingOption(parameters, &capturer, true); 1767 stream = SetDenoisingOption(parameters, &capturer, true);
1718 1768
1719 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set."; 1769 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
1720 EXPECT_TRUE(vp9_settings.denoisingOn); 1770 EXPECT_TRUE(vp9_settings.denoisingOn);
1721 EXPECT_TRUE(vp9_settings.frameDroppingOn); 1771 EXPECT_TRUE(vp9_settings.frameDroppingOn);
1722 1772
1723 // In screen-share mode, denoising is forced off. 1773 // In screen-share mode, denoising is forced off.
1724 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, nullptr)); 1774 parameters.options.is_screencast = rtc::Optional<bool>(true);
1725 capturer.SetScreencast(true); 1775 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1726 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1727 1776
1728 EXPECT_TRUE(capturer.CaptureFrame());
1729 stream = SetDenoisingOption(parameters, &capturer, false); 1777 stream = SetDenoisingOption(parameters, &capturer, false);
1730 1778
1731 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set."; 1779 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
1732 EXPECT_FALSE(vp9_settings.denoisingOn); 1780 EXPECT_FALSE(vp9_settings.denoisingOn);
1733 // Frame dropping always off for screen sharing. 1781 // Frame dropping always off for screen sharing.
1734 EXPECT_FALSE(vp9_settings.frameDroppingOn); 1782 EXPECT_FALSE(vp9_settings.frameDroppingOn);
1735 1783
1736 stream = SetDenoisingOption(parameters, &capturer, false); 1784 stream = SetDenoisingOption(parameters, &capturer, false);
1737 1785
1738 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set."; 1786 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
(...skipping 21 matching lines...) Expand all
1760 parameters.codecs.push_back(codec); 1808 parameters.codecs.push_back(codec);
1761 1809
1762 MediaConfig media_config = MediaConfig(); 1810 MediaConfig media_config = MediaConfig();
1763 channel_.reset( 1811 channel_.reset(
1764 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); 1812 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
1765 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 1813 ASSERT_TRUE(channel_->SetSendParameters(parameters));
1766 1814
1767 AddSendStream(); 1815 AddSendStream();
1768 1816
1769 cricket::FakeVideoCapturer capturer; 1817 cricket::FakeVideoCapturer capturer;
1770 capturer.SetScreencast(false);
1771 ASSERT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1818 ASSERT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1772 ASSERT_EQ(cricket::CS_RUNNING, 1819 ASSERT_EQ(cricket::CS_RUNNING,
1773 capturer.Start(capturer.GetSupportedFormats()->front())); 1820 capturer.Start(capturer.GetSupportedFormats()->front()));
1774 ASSERT_TRUE(channel_->SetSend(true)); 1821 ASSERT_TRUE(channel_->SetSend(true));
1775 1822
1776 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); 1823 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size());
1777 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front(); 1824 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front();
1778 webrtc::LoadObserver* overuse_callback = 1825 webrtc::LoadObserver* overuse_callback =
1779 send_stream->GetConfig().overuse_callback; 1826 send_stream->GetConfig().overuse_callback;
1780 ASSERT_TRUE(overuse_callback != NULL); 1827 ASSERT_TRUE(overuse_callback != NULL);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 cricket::VideoSendParameters parameters; 1874 cricket::VideoSendParameters parameters;
1828 parameters.codecs.push_back(codec); 1875 parameters.codecs.push_back(codec);
1829 1876
1830 MediaConfig media_config = MediaConfig(); 1877 MediaConfig media_config = MediaConfig();
1831 if (!enable_overuse) { 1878 if (!enable_overuse) {
1832 media_config.video.enable_cpu_overuse_detection = false; 1879 media_config.video.enable_cpu_overuse_detection = false;
1833 } 1880 }
1834 channel_.reset( 1881 channel_.reset(
1835 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); 1882 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
1836 1883
1884 parameters.options.is_screencast = rtc::Optional<bool>(is_screenshare);
1837 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1885 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1838 1886
1839 AddSendStream(); 1887 AddSendStream();
1840 1888
1841 cricket::FakeVideoCapturer capturer; 1889 cricket::FakeVideoCapturer capturer;
1842 capturer.SetScreencast(is_screenshare);
1843 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1890 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1844 EXPECT_EQ(cricket::CS_RUNNING, 1891 EXPECT_EQ(cricket::CS_RUNNING,
1845 capturer.Start(capturer.GetSupportedFormats()->front())); 1892 capturer.Start(capturer.GetSupportedFormats()->front()));
1846 1893
1847 EXPECT_TRUE(channel_->SetSend(true)); 1894 EXPECT_TRUE(channel_->SetSend(true));
1848 1895
1849 // Trigger overuse. 1896 // Trigger overuse.
1850 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); 1897 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size());
1851 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front(); 1898 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front();
1852 webrtc::LoadObserver* overuse_callback = 1899 webrtc::LoadObserver* overuse_callback =
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
3182 // Test that we normalize send codec format size in simulcast. 3229 // Test that we normalize send codec format size in simulcast.
3183 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3230 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3184 cricket::VideoCodec codec(kVp8Codec270p); 3231 cricket::VideoCodec codec(kVp8Codec270p);
3185 codec.width += 1; 3232 codec.width += 1;
3186 codec.height += 1; 3233 codec.height += 1;
3187 VerifySimulcastSettings(codec, 2, 2); 3234 VerifySimulcastSettings(codec, 2, 2);
3188 } 3235 }
3189 } // namespace cricket 3236 } // namespace cricket
3190 3237
3191 #endif // HAVE_WEBRTC_VIDEO 3238 #endif // HAVE_WEBRTC_VIDEO
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | webrtc/video/video_send_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698