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

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

Issue 1318193003: Enable automatic resizing for RTX-enabled senders. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix typo 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 | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | no next file » | 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 * 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 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 void TestReceiveUnsignalledSsrcPacket(uint8_t payload_type, 1015 void TestReceiveUnsignalledSsrcPacket(uint8_t payload_type,
1016 bool expect_created_receive_stream); 1016 bool expect_created_receive_stream);
1017 1017
1018 FakeVideoSendStream* SetDenoisingOption(bool enabled) { 1018 FakeVideoSendStream* SetDenoisingOption(bool enabled) {
1019 VideoOptions options; 1019 VideoOptions options;
1020 options.video_noise_reduction.Set(enabled); 1020 options.video_noise_reduction.Set(enabled);
1021 channel_->SetOptions(options); 1021 channel_->SetOptions(options);
1022 return fake_call_->GetVideoSendStreams().back(); 1022 return fake_call_->GetVideoSendStreams().back();
1023 } 1023 }
1024 1024
1025 FakeVideoSendStream* SetUpSimulcast(bool enabled) { 1025 FakeVideoSendStream* SetUpSimulcast(bool enabled, bool with_rtx) {
1026 const int kRtxSsrcOffset = 0xDEADBEEF;
1026 last_ssrc_ += 3; 1027 last_ssrc_ += 3;
1027 if (enabled) { 1028 std::vector<uint32_t> ssrcs;
1028 std::vector<uint32_t> ssrcs; 1029 std::vector<uint32_t> rtx_ssrcs;
1029 ssrcs.push_back(last_ssrc_); 1030 uint32_t num_streams = enabled ? 3 : 1;
1030 ssrcs.push_back(last_ssrc_ + 1); 1031 for (uint32_t i = 0; i < num_streams; ++i) {
1031 ssrcs.push_back(last_ssrc_ + 2); 1032 uint32_t ssrc = last_ssrc_ + i;
1032 return AddSendStream(CreateSimStreamParams("cname", ssrcs)); 1033 ssrcs.push_back(ssrc);
1033 } else { 1034 if (with_rtx) {
1034 return AddSendStream(StreamParams::CreateLegacy(last_ssrc_)); 1035 rtx_ssrcs.push_back(ssrc + kRtxSsrcOffset);
1036 }
1035 } 1037 }
1038 if (with_rtx) {
1039 return AddSendStream(
1040 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs));
1041 }
1042 return AddSendStream(CreateSimStreamParams("cname", ssrcs));
1036 } 1043 }
1037 1044
1038 FakeCall* fake_call_; 1045 FakeCall* fake_call_;
1039 rtc::scoped_ptr<VideoMediaChannel> channel_; 1046 rtc::scoped_ptr<VideoMediaChannel> channel_;
1040 uint32 last_ssrc_; 1047 uint32 last_ssrc_;
1041 }; 1048 };
1042 1049
1043 TEST_F(WebRtcVideoChannel2Test, SetsSyncGroupFromSyncLabel) { 1050 TEST_F(WebRtcVideoChannel2Test, SetsSyncGroupFromSyncLabel) {
1044 const uint32 kVideoSsrc = 123; 1051 const uint32 kVideoSsrc = 123;
1045 const std::string kSyncLabel = "AvSyncLabel"; 1052 const std::string kSyncLabel = "AvSyncLabel";
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 webrtc::VideoCodecVP8 vp8_settings; 1570 webrtc::VideoCodecVP8 vp8_settings;
1564 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; 1571 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
1565 EXPECT_TRUE(vp8_settings.denoisingOn); 1572 EXPECT_TRUE(vp8_settings.denoisingOn);
1566 } 1573 }
1567 1574
1568 TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) { 1575 TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) {
1569 std::vector<cricket::VideoCodec> codecs; 1576 std::vector<cricket::VideoCodec> codecs;
1570 codecs.push_back(kVp8Codec720p); 1577 codecs.push_back(kVp8Codec720p);
1571 ASSERT_TRUE(channel_->SetSendCodecs(codecs)); 1578 ASSERT_TRUE(channel_->SetSendCodecs(codecs));
1572 1579
1573 FakeVideoSendStream* stream = SetUpSimulcast(false); 1580 // Single-stream settings should apply with RTX as well (verifies that we
1581 // check number of regular SSRCs and not StreamParams::ssrcs which contains
1582 // both RTX and regular SSRCs).
1583 FakeVideoSendStream* stream = SetUpSimulcast(false, true);
1574 1584
1575 cricket::FakeVideoCapturer capturer; 1585 cricket::FakeVideoCapturer capturer;
1576 capturer.SetScreencast(false); 1586 capturer.SetScreencast(false);
1577 EXPECT_EQ(cricket::CS_RUNNING, 1587 EXPECT_EQ(cricket::CS_RUNNING,
1578 capturer.Start(capturer.GetSupportedFormats()->front())); 1588 capturer.Start(capturer.GetSupportedFormats()->front()));
1579 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1589 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1580 channel_->SetSend(true); 1590 channel_->SetSend(true);
1581 1591
1582 EXPECT_TRUE(capturer.CaptureFrame()); 1592 EXPECT_TRUE(capturer.CaptureFrame());
1583 1593
1584 stream = SetDenoisingOption(false); 1594 stream = SetDenoisingOption(false);
1585 1595
1586 webrtc::VideoCodecVP8 vp8_settings; 1596 webrtc::VideoCodecVP8 vp8_settings;
1587 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; 1597 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
1588 EXPECT_FALSE(vp8_settings.denoisingOn); 1598 EXPECT_FALSE(vp8_settings.denoisingOn);
1589 EXPECT_TRUE(vp8_settings.automaticResizeOn); 1599 EXPECT_TRUE(vp8_settings.automaticResizeOn);
1590 EXPECT_TRUE(vp8_settings.frameDroppingOn); 1600 EXPECT_TRUE(vp8_settings.frameDroppingOn);
1591 1601
1592 stream = SetDenoisingOption(true); 1602 stream = SetDenoisingOption(true);
1593 1603
1594 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; 1604 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
1595 EXPECT_TRUE(vp8_settings.denoisingOn); 1605 EXPECT_TRUE(vp8_settings.denoisingOn);
1596 EXPECT_TRUE(vp8_settings.automaticResizeOn); 1606 EXPECT_TRUE(vp8_settings.automaticResizeOn);
1597 EXPECT_TRUE(vp8_settings.frameDroppingOn); 1607 EXPECT_TRUE(vp8_settings.frameDroppingOn);
1598 1608
1599 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL)); 1609 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
1600 stream = SetUpSimulcast(true); 1610 stream = SetUpSimulcast(true, false);
1601 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1611 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1602 channel_->SetSend(true); 1612 channel_->SetSend(true);
1603 EXPECT_TRUE(capturer.CaptureFrame()); 1613 EXPECT_TRUE(capturer.CaptureFrame());
1604 1614
1605 EXPECT_EQ(3, stream->GetVideoStreams().size()); 1615 EXPECT_EQ(3, stream->GetVideoStreams().size());
1606 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; 1616 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
1607 // Autmatic resize off when using simulcast. 1617 // Autmatic resize off when using simulcast.
1608 EXPECT_FALSE(vp8_settings.automaticResizeOn); 1618 EXPECT_FALSE(vp8_settings.automaticResizeOn);
1609 EXPECT_TRUE(vp8_settings.frameDroppingOn); 1619 EXPECT_TRUE(vp8_settings.frameDroppingOn);
1610 1620
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 } 1661 }
1652 1662
1653 cricket::FakeWebRtcVideoEncoderFactory encoder_factory_; 1663 cricket::FakeWebRtcVideoEncoderFactory encoder_factory_;
1654 }; 1664 };
1655 1665
1656 TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) { 1666 TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) {
1657 std::vector<cricket::VideoCodec> codecs; 1667 std::vector<cricket::VideoCodec> codecs;
1658 codecs.push_back(kVp9Codec); 1668 codecs.push_back(kVp9Codec);
1659 ASSERT_TRUE(channel_->SetSendCodecs(codecs)); 1669 ASSERT_TRUE(channel_->SetSendCodecs(codecs));
1660 1670
1661 FakeVideoSendStream* stream = SetUpSimulcast(false); 1671 FakeVideoSendStream* stream = SetUpSimulcast(false, false);
1662 1672
1663 cricket::FakeVideoCapturer capturer; 1673 cricket::FakeVideoCapturer capturer;
1664 capturer.SetScreencast(false); 1674 capturer.SetScreencast(false);
1665 EXPECT_EQ(cricket::CS_RUNNING, 1675 EXPECT_EQ(cricket::CS_RUNNING,
1666 capturer.Start(capturer.GetSupportedFormats()->front())); 1676 capturer.Start(capturer.GetSupportedFormats()->front()));
1667 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); 1677 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1668 channel_->SetSend(true); 1678 channel_->SetSend(true);
1669 1679
1670 EXPECT_TRUE(capturer.CaptureFrame()); 1680 EXPECT_TRUE(capturer.CaptureFrame());
1671 1681
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after
3180 // Ensures that the correct settings are applied to the codec when two temporal 3190 // Ensures that the correct settings are applied to the codec when two temporal
3181 // layer screencasting is enabled, and that the correct simulcast settings are 3191 // layer screencasting is enabled, and that the correct simulcast settings are
3182 // reapplied when disabling screencasting. 3192 // reapplied when disabling screencasting.
3183 TEST_F(WebRtcVideoChannel2SimulcastTest, 3193 TEST_F(WebRtcVideoChannel2SimulcastTest,
3184 DISABLED_TwoTemporalLayerScreencastSettings) { 3194 DISABLED_TwoTemporalLayerScreencastSettings) {
3185 // TODO(pbos): Implement. 3195 // TODO(pbos): Implement.
3186 FAIL() << "Not implemented."; 3196 FAIL() << "Not implemented.";
3187 } 3197 }
3188 3198
3189 } // namespace cricket 3199 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698