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

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

Issue 1810973002: Add support for configuring the number of spatial/temporal layers for VP9 through a field trial. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: address comments 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') | 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 * 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 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; 1767 ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
1768 EXPECT_FALSE(vp8_settings.denoisingOn); 1768 EXPECT_FALSE(vp8_settings.denoisingOn);
1769 EXPECT_FALSE(vp8_settings.automaticResizeOn); 1769 EXPECT_FALSE(vp8_settings.automaticResizeOn);
1770 EXPECT_FALSE(vp8_settings.frameDroppingOn); 1770 EXPECT_FALSE(vp8_settings.frameDroppingOn);
1771 1771
1772 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL)); 1772 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
1773 } 1773 }
1774 1774
1775 class Vp9SettingsTest : public WebRtcVideoChannel2Test { 1775 class Vp9SettingsTest : public WebRtcVideoChannel2Test {
1776 public: 1776 public:
1777 Vp9SettingsTest() : WebRtcVideoChannel2Test() { 1777 Vp9SettingsTest() : Vp9SettingsTest("") {}
1778 explicit Vp9SettingsTest(const char* field_trials)
1779 : WebRtcVideoChannel2Test(field_trials) {
1778 encoder_factory_.AddSupportedVideoCodecType(webrtc::kVideoCodecVP9, "VP9"); 1780 encoder_factory_.AddSupportedVideoCodecType(webrtc::kVideoCodecVP9, "VP9");
1779 } 1781 }
1780 virtual ~Vp9SettingsTest() {} 1782 virtual ~Vp9SettingsTest() {}
1781 1783
1782 protected: 1784 protected:
1783 void SetUp() override { 1785 void SetUp() override {
1784 engine_.SetExternalEncoderFactory(&encoder_factory_); 1786 engine_.SetExternalEncoderFactory(&encoder_factory_);
1785 1787
1786 WebRtcVideoChannel2Test::SetUp(); 1788 WebRtcVideoChannel2Test::SetUp();
1787 } 1789 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 1843
1842 stream = SetDenoisingOption(parameters, &capturer, false); 1844 stream = SetDenoisingOption(parameters, &capturer, false);
1843 1845
1844 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set."; 1846 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
1845 EXPECT_FALSE(vp9_settings.denoisingOn); 1847 EXPECT_FALSE(vp9_settings.denoisingOn);
1846 EXPECT_FALSE(vp9_settings.frameDroppingOn); 1848 EXPECT_FALSE(vp9_settings.frameDroppingOn);
1847 1849
1848 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL)); 1850 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
1849 } 1851 }
1850 1852
1853 class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest {
1854 public:
1855 Vp9SettingsTestWithFieldTrial(const char* field_trials)
1856 : Vp9SettingsTest(field_trials) {}
1857
1858 protected:
1859 void VerifySettings(int num_spatial_layers, int num_temporal_layers) {
1860 cricket::VideoSendParameters parameters;
1861 parameters.codecs.push_back(kVp9Codec);
1862 ASSERT_TRUE(channel_->SetSendParameters(parameters));
1863
1864 FakeVideoSendStream* stream = SetUpSimulcast(false, false);
1865
1866 cricket::FakeVideoCapturer capturer;
1867 EXPECT_EQ(cricket::CS_RUNNING,
1868 capturer.Start(capturer.GetSupportedFormats()->front()));
1869 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1870 channel_->SetSend(true);
1871
1872 EXPECT_TRUE(capturer.CaptureFrame());
1873
1874 webrtc::VideoCodecVP9 vp9_settings;
1875 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
1876 EXPECT_EQ(num_spatial_layers, vp9_settings.numberOfSpatialLayers);
1877 EXPECT_EQ(num_temporal_layers, vp9_settings.numberOfTemporalLayers);
1878
1879 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
1880 }
1881 };
1882
1883 class Vp9SettingsTestWithNoFlag : public Vp9SettingsTestWithFieldTrial {
1884 public:
1885 Vp9SettingsTestWithNoFlag() : Vp9SettingsTestWithFieldTrial("") {}
1886 };
1887
1888 TEST_F(Vp9SettingsTestWithNoFlag, VerifySettings) {
1889 const int kNumSpatialLayers = 1;
1890 const int kNumTemporalLayers = 1;
1891 VerifySettings(kNumSpatialLayers, kNumTemporalLayers);
1892 }
1893
1894 class Vp9SettingsTestWithInvalidFlag : public Vp9SettingsTestWithFieldTrial {
1895 public:
1896 Vp9SettingsTestWithInvalidFlag()
1897 : Vp9SettingsTestWithFieldTrial("WebRTC-SupportVP9SVC/Default/") {}
1898 };
1899
1900 TEST_F(Vp9SettingsTestWithInvalidFlag, VerifySettings) {
1901 const int kNumSpatialLayers = 1;
1902 const int kNumTemporalLayers = 1;
1903 VerifySettings(kNumSpatialLayers, kNumTemporalLayers);
1904 }
1905
1906 class Vp9SettingsTestWith2SL3TLFlag : public Vp9SettingsTestWithFieldTrial {
1907 public:
1908 Vp9SettingsTestWith2SL3TLFlag()
1909 : Vp9SettingsTestWithFieldTrial(
1910 "WebRTC-SupportVP9SVC/EnabledByFlag_2SL3TL/") {}
1911 };
1912
1913 TEST_F(Vp9SettingsTestWith2SL3TLFlag, VerifySettings) {
1914 const int kNumSpatialLayers = 2;
1915 const int kNumTemporalLayers = 3;
1916 VerifySettings(kNumSpatialLayers, kNumTemporalLayers);
1917 }
1918
1851 TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruse) { 1919 TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruse) {
1852 TestCpuAdaptation(true, false); 1920 TestCpuAdaptation(true, false);
1853 } 1921 }
1854 1922
1855 TEST_F(WebRtcVideoChannel2Test, DoesNotAdaptOnOveruseWhenDisabled) { 1923 TEST_F(WebRtcVideoChannel2Test, DoesNotAdaptOnOveruseWhenDisabled) {
1856 TestCpuAdaptation(false, false); 1924 TestCpuAdaptation(false, false);
1857 } 1925 }
1858 1926
1859 TEST_F(WebRtcVideoChannel2Test, DoesNotAdaptOnOveruseWhenScreensharing) { 1927 TEST_F(WebRtcVideoChannel2Test, DoesNotAdaptOnOveruseWhenScreensharing) {
1860 TestCpuAdaptation(true, true); 1928 TestCpuAdaptation(true, true);
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 3354
3287 // Test that we normalize send codec format size in simulcast. 3355 // Test that we normalize send codec format size in simulcast.
3288 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3356 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3289 cricket::VideoCodec codec(kVp8Codec270p); 3357 cricket::VideoCodec codec(kVp8Codec270p);
3290 codec.width += 1; 3358 codec.width += 1;
3291 codec.height += 1; 3359 codec.height += 1;
3292 VerifySimulcastSettings(codec, 2, 2); 3360 VerifySimulcastSettings(codec, 2, 2);
3293 } 3361 }
3294 } // namespace cricket 3362 } // namespace cricket
3295 3363
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698