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> // max | 10 #include <algorithm> // max |
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1781 const std::vector<VideoReceiveStream*>& receive_streams) override { | 1781 const std::vector<VideoReceiveStream*>& receive_streams) override { |
1782 send_stream_ = send_stream; | 1782 send_stream_ = send_stream; |
1783 } | 1783 } |
1784 | 1784 |
1785 VideoSendStream* send_stream_; | 1785 VideoSendStream* send_stream_; |
1786 } test; | 1786 } test; |
1787 | 1787 |
1788 RunBaseTest(&test, FakeNetworkPipe::Config()); | 1788 RunBaseTest(&test, FakeNetworkPipe::Config()); |
1789 } | 1789 } |
1790 | 1790 |
1791 class VP9HeaderObeserver : public test::SendTest { | 1791 class Vp9HeaderObserver : public test::SendTest { |
1792 public: | 1792 public: |
1793 VP9HeaderObeserver() | 1793 Vp9HeaderObserver() |
1794 : SendTest(VideoSendStreamTest::kDefaultTimeoutMs), | 1794 : SendTest(VideoSendStreamTest::kDefaultTimeoutMs), |
1795 vp9_encoder_(VP9Encoder::Create()), | 1795 vp9_encoder_(VP9Encoder::Create()), |
1796 vp9_settings_(VideoEncoder::GetDefaultVp9Settings()) { | 1796 vp9_settings_(VideoEncoder::GetDefaultVp9Settings()), |
1797 vp9_settings_.numberOfTemporalLayers = 1; | 1797 packets_sent_(0), |
1798 vp9_settings_.numberOfSpatialLayers = 2; | 1798 frames_sent_(0) {} |
1799 } | |
1800 | 1799 |
1801 virtual void ModifyConfigsHook( | 1800 virtual void ModifyConfigsHook( |
1802 VideoSendStream::Config* send_config, | 1801 VideoSendStream::Config* send_config, |
1803 std::vector<VideoReceiveStream::Config>* receive_configs, | 1802 std::vector<VideoReceiveStream::Config>* receive_configs, |
1804 VideoEncoderConfig* encoder_config) {} | 1803 VideoEncoderConfig* encoder_config) {} |
1805 | 1804 |
1806 virtual void InspectHeader(RTPVideoHeaderVP9* vp9videoHeader) = 0; | 1805 virtual void InspectHeader(const RTPVideoHeaderVP9& vp9) = 0; |
1807 | 1806 |
1808 private: | 1807 private: |
1809 const int kVp9PayloadType = 105; | 1808 const int kVp9PayloadType = 105; |
1810 | 1809 |
1811 void ModifyConfigs(VideoSendStream::Config* send_config, | 1810 void ModifyConfigs(VideoSendStream::Config* send_config, |
1812 std::vector<VideoReceiveStream::Config>* receive_configs, | 1811 std::vector<VideoReceiveStream::Config>* receive_configs, |
1813 VideoEncoderConfig* encoder_config) override { | 1812 VideoEncoderConfig* encoder_config) override { |
1814 encoder_config->encoder_specific_settings = &vp9_settings_; | 1813 encoder_config->encoder_specific_settings = &vp9_settings_; |
1815 encoder_config->content_type = VideoEncoderConfig::ContentType::kScreen; | |
1816 send_config->encoder_settings.encoder = vp9_encoder_.get(); | 1814 send_config->encoder_settings.encoder = vp9_encoder_.get(); |
1817 send_config->encoder_settings.payload_name = "VP9"; | 1815 send_config->encoder_settings.payload_name = "VP9"; |
1818 send_config->encoder_settings.payload_type = kVp9PayloadType; | 1816 send_config->encoder_settings.payload_type = kVp9PayloadType; |
1819 ModifyConfigsHook(send_config, receive_configs, encoder_config); | 1817 ModifyConfigsHook(send_config, receive_configs, encoder_config); |
1818 EXPECT_EQ(1u, encoder_config->streams.size()); | |
1819 encoder_config->streams[0].temporal_layer_thresholds_bps.resize( | |
1820 vp9_settings_.numberOfTemporalLayers - 1); | |
1821 encoder_config_ = *encoder_config; | |
1820 } | 1822 } |
1821 | 1823 |
1822 void PerformTest() override { | 1824 void PerformTest() override { |
1823 EXPECT_EQ(kEventSignaled, Wait()) | 1825 EXPECT_EQ(kEventSignaled, Wait()) |
1824 << "Test timed out waiting for VP9 packet"; | 1826 << "Test timed out waiting for VP9 packet"; |
1825 } | 1827 } |
1826 | 1828 |
1827 Action OnSendRtp(const uint8_t* packet, size_t length) override { | 1829 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
1828 RTPHeader header; | 1830 RTPHeader header; |
1829 EXPECT_TRUE(parser_->Parse(packet, length, &header)); | 1831 EXPECT_TRUE(parser_->Parse(packet, length, &header)); |
1830 | 1832 |
1831 if (header.payloadType == kVp9PayloadType) { | 1833 EXPECT_EQ(kVp9PayloadType, header.payloadType); |
1832 RtpDepacketizerVp9 vp9depacketizer; | 1834 const uint8_t* payload = packet + header.headerLength; |
1833 RtpDepacketizer::ParsedPayload vp9payload; | 1835 size_t payload_length = length - header.headerLength - header.paddingLength; |
1834 const uint8_t* vp9_packet = packet + header.headerLength; | 1836 |
1835 size_t payload_length = | 1837 bool new_packet = packets_sent_ == 0 || |
1836 length - header.headerLength - header.paddingLength; | 1838 IsNewerSequenceNumber(header.sequenceNumber, |
1837 | 1839 last_header_.sequenceNumber); |
1838 if (payload_length > 0) { | 1840 if (payload_length > 0 && new_packet) { |
1839 bool parse_vp9header_successful = | 1841 RtpDepacketizer::ParsedPayload parsed; |
1840 vp9depacketizer.Parse(&vp9payload, vp9_packet, payload_length); | 1842 RtpDepacketizerVp9 depacketizer; |
1841 bool is_vp9_codec_type = | 1843 EXPECT_TRUE(depacketizer.Parse(&parsed, payload, payload_length)); |
1842 vp9payload.type.Video.codec == RtpVideoCodecTypes::kRtpVideoVp9; | 1844 EXPECT_EQ(RtpVideoCodecTypes::kRtpVideoVp9, parsed.type.Video.codec); |
1843 EXPECT_TRUE(parse_vp9header_successful); | 1845 |
1844 EXPECT_TRUE(is_vp9_codec_type); | 1846 VerifyHeader(parsed.type.Video.codecHeader.VP9); |
1845 | 1847 CompareConsecutiveFrames(header, parsed.type.Video.codecHeader.VP9); |
1846 RTPVideoHeaderVP9* vp9videoHeader = | 1848 InspectHeader(parsed.type.Video.codecHeader.VP9); |
1847 &vp9payload.type.Video.codecHeader.VP9; | 1849 |
1848 if (parse_vp9header_successful && is_vp9_codec_type) { | 1850 ++packets_sent_; |
1849 InspectHeader(vp9videoHeader); | 1851 if (header.markerBit) { |
1850 } else { | 1852 ++frames_sent_; |
1851 observation_complete_->Set(); | |
1852 } | |
1853 } | 1853 } |
1854 } | 1854 last_header_ = header; |
1855 | 1855 last_vp9_ = parsed.type.Video.codecHeader.VP9; |
1856 } | |
1856 return SEND_PACKET; | 1857 return SEND_PACKET; |
1857 } | 1858 } |
1858 | 1859 |
1859 protected: | 1860 protected: |
1861 bool ContinuousPictureId(const RTPVideoHeaderVP9& vp9) const { | |
1862 if (last_vp9_.picture_id > vp9.picture_id) { | |
1863 return vp9.picture_id == 0; // Wrap. | |
1864 } else { | |
1865 return vp9.picture_id == last_vp9_.picture_id + 1; | |
1866 } | |
1867 } | |
1868 | |
1869 void VerifyTl0idx(const RTPVideoHeaderVP9& vp9) const { | |
1870 if (vp9.tl0_pic_idx == kNoTl0PicIdx) | |
1871 return; | |
1872 | |
1873 uint8_t expected_tl0_idx = last_vp9_.tl0_pic_idx; | |
1874 if (vp9.temporal_idx == 0) | |
1875 ++expected_tl0_idx; | |
1876 EXPECT_EQ(expected_tl0_idx, vp9.tl0_pic_idx); | |
1877 } | |
1878 | |
1879 bool IsNewPictureId(const RTPVideoHeaderVP9& vp9) const { | |
1880 return frames_sent_ > 0 && (vp9.picture_id != last_vp9_.picture_id); | |
1881 } | |
1882 | |
1883 bool IsFirstPacketInKeyFrame(const RTPVideoHeaderVP9& vp9) const { | |
1884 return !vp9.inter_pic_predicted && // P | |
1885 vp9.beginning_of_frame && // B | |
1886 vp9.spatial_idx == 0; | |
1887 } | |
1888 | |
1889 // Flexible mode (F=1): Non-flexible mode (F=0): | |
1890 // | |
1891 // +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ | |
1892 // |I|P|L|F|B|E|V|-| |I|P|L|F|B|E|V|-| | |
1893 // +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ | |
1894 // I: |M| PICTURE ID | I: |M| PICTURE ID | | |
1895 // +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ | |
1896 // M: | EXTENDED PID | M: | EXTENDED PID | | |
1897 // +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ | |
1898 // L: | T |U| S |D| L: | T |U| S |D| | |
1899 // +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ | |
1900 // P,F: | P_DIFF |X|N| | TL0PICIDX | | |
1901 // +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ | |
1902 // X: |EXTENDED P_DIFF| V: | SS .. | | |
1903 // +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ | |
1904 // V: | SS .. | | |
1905 // +-+-+-+-+-+-+-+-+ | |
1906 void VerifyHeader(const RTPVideoHeaderVP9& vp9) const { | |
1907 EXPECT_EQ(vp9_settings_.flexibleMode, vp9.flexible_mode); // F | |
1908 EXPECT_EQ(kMaxTwoBytePictureId, vp9.max_picture_id); // M:1 | |
1909 EXPECT_NE(kNoPictureId, vp9.picture_id); // I:1 | |
1910 EXPECT_GE(vp9.spatial_idx, 0); // S | |
1911 EXPECT_LE(vp9.spatial_idx, vp9_settings_.numberOfSpatialLayers - 1); | |
1912 EXPECT_EQ(vp9.spatial_idx > 0, vp9.inter_layer_predicted); // D | |
1913 if (vp9.ss_data_available) // V | |
1914 VerifySsData(vp9); | |
1915 if (packets_sent_ == 0) | |
1916 EXPECT_TRUE(IsFirstPacketInKeyFrame(vp9)); | |
1917 if (frames_sent_ == 0) | |
1918 EXPECT_FALSE(vp9.inter_pic_predicted); // P (0:key, 1:delta) | |
1919 } | |
1920 | |
1921 // Scalability structure (SS). | |
1922 // | |
1923 // +-+-+-+-+-+-+-+-+ | |
1924 // V: | N_S |Y|G|-|-|-| | |
1925 // +-+-+-+-+-+-+-+-+ | |
1926 // Y: | WIDTH | N_S + 1 times | |
1927 // +-+-+-+-+-+-+-+-+ | |
1928 // | HEIGHT | | |
1929 // +-+-+-+-+-+-+-+-+ | |
1930 // G: | N_G | | |
1931 // +-+-+-+-+-+-+-+-+ | |
1932 // N_G: | T |U| R |-|-| N_G times | |
1933 // +-+-+-+-+-+-+-+-+ | |
1934 // | P_DIFF | R times | |
1935 // +-+-+-+-+-+-+-+-+ | |
1936 void VerifySsData(const RTPVideoHeaderVP9& vp9) const { | |
1937 EXPECT_TRUE(vp9.ss_data_available); // V | |
1938 EXPECT_EQ(vp9_settings_.numberOfSpatialLayers, // N_S + 1 | |
1939 vp9.num_spatial_layers); | |
1940 EXPECT_TRUE(vp9.spatial_layer_resolution_present); // Y:1 | |
1941 size_t expected_width = encoder_config_.streams[0].width; | |
1942 size_t expected_height = encoder_config_.streams[0].height; | |
1943 for (int i = vp9.num_spatial_layers - 1; i >= 0; --i) { | |
1944 EXPECT_EQ(expected_width, vp9.width[i]); // WIDTH | |
1945 EXPECT_EQ(expected_height, vp9.height[i]); // HEIGHT | |
1946 expected_width /= 2; | |
1947 expected_height /= 2; | |
1948 } | |
1949 } | |
1950 | |
1951 void CompareConsecutiveFrames(const RTPHeader& header, | |
1952 const RTPVideoHeaderVP9& vp9) const { | |
1953 bool new_frame = packets_sent_ == 0 || | |
1954 IsNewerTimestamp(header.timestamp, last_header_.timestamp); | |
1955 if (!new_frame) { | |
1956 EXPECT_EQ(last_header_.timestamp, header.timestamp); | |
1957 EXPECT_EQ(last_vp9_.picture_id, vp9.picture_id); | |
1958 EXPECT_EQ(last_vp9_.tl0_pic_idx, vp9.tl0_pic_idx); | |
1959 return; | |
1960 } | |
1961 // New frame. | |
1962 EXPECT_TRUE(vp9.beginning_of_frame); | |
1963 | |
1964 // Compare with last packet in previous frame. | |
1965 if (frames_sent_ == 0) | |
1966 return; | |
1967 EXPECT_TRUE(last_vp9_.end_of_frame); | |
1968 EXPECT_TRUE(last_header_.markerBit); | |
1969 EXPECT_TRUE(ContinuousPictureId(vp9)); | |
1970 VerifyTl0idx(vp9); | |
1971 } | |
1972 | |
1860 rtc::scoped_ptr<VP9Encoder> vp9_encoder_; | 1973 rtc::scoped_ptr<VP9Encoder> vp9_encoder_; |
1861 VideoCodecVP9 vp9_settings_; | 1974 VideoCodecVP9 vp9_settings_; |
1975 webrtc::VideoEncoderConfig encoder_config_; | |
1976 RTPHeader last_header_; | |
1977 RTPVideoHeaderVP9 last_vp9_; | |
1978 size_t packets_sent_; | |
1979 size_t frames_sent_; | |
1862 }; | 1980 }; |
1863 | 1981 |
1864 TEST_F(VideoSendStreamTest, DISABLED_VP9FlexMode) { | 1982 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_1Tl1SLayers) { |
pbos-webrtc
2015/11/10 18:21:19
This (and below) looks like something that can be
åsapersson
2015/11/16 15:54:00
Changed how this is setup, ptal.
| |
1865 class FlexibleMode : public VP9HeaderObeserver { | 1983 static const size_t kNumFramesToSend = 100; |
1866 void ModifyConfigsHook( | 1984 static const size_t kNumExpectedFramesInGof = 1; |
1867 VideoSendStream::Config* send_config, | 1985 class NonFlexibleMode : public Vp9HeaderObserver { |
1868 std::vector<VideoReceiveStream::Config>* receive_configs, | 1986 void ModifyConfigsHook( |
1869 VideoEncoderConfig* encoder_config) override { | 1987 VideoSendStream::Config* send_config, |
1988 std::vector<VideoReceiveStream::Config>* receive_configs, | |
1989 VideoEncoderConfig* encoder_config) override { | |
1990 vp9_settings_.frameDroppingOn = false; | |
1991 vp9_settings_.flexibleMode = false; | |
1992 vp9_settings_.numberOfTemporalLayers = 1; | |
1993 vp9_settings_.numberOfSpatialLayers = 1; | |
1994 } | |
1995 | |
1996 void InspectHeader(const RTPVideoHeaderVP9& vp9) override { | |
1997 EXPECT_EQ(kNoTl0PicIdx, vp9.tl0_pic_idx); | |
1998 EXPECT_EQ(0, vp9.spatial_idx); | |
1999 EXPECT_EQ(IsFirstPacketInKeyFrame(vp9), vp9.ss_data_available); | |
2000 | |
2001 if (vp9.ss_data_available) | |
2002 EXPECT_EQ(kNumExpectedFramesInGof, vp9.gof.num_frames_in_gof); | |
2003 | |
2004 if (frames_sent_ > kNumFramesToSend) | |
2005 observation_complete_->Set(); | |
2006 } | |
2007 } test; | |
2008 | |
2009 RunBaseTest(&test, FakeNetworkPipe::Config()); | |
2010 } | |
2011 | |
2012 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_2Tl1SLayers) { | |
2013 static const size_t kNumFramesToSend = 100; | |
2014 static const size_t kNumExpectedFramesInGof = 2; | |
2015 class NonFlexibleMode : public Vp9HeaderObserver { | |
2016 void ModifyConfigsHook( | |
2017 VideoSendStream::Config* send_config, | |
2018 std::vector<VideoReceiveStream::Config>* receive_configs, | |
2019 VideoEncoderConfig* encoder_config) override { | |
2020 vp9_settings_.frameDroppingOn = false; | |
2021 vp9_settings_.flexibleMode = false; | |
2022 vp9_settings_.numberOfTemporalLayers = 2; | |
2023 vp9_settings_.numberOfSpatialLayers = 1; | |
2024 } | |
2025 | |
2026 void InspectHeader(const RTPVideoHeaderVP9& vp9) override { | |
2027 EXPECT_NE(kNoTl0PicIdx, vp9.tl0_pic_idx); | |
2028 EXPECT_GE(vp9.temporal_idx, 0); | |
2029 EXPECT_LE(vp9.temporal_idx, 1); | |
2030 EXPECT_EQ(0, vp9.spatial_idx); | |
2031 EXPECT_EQ(IsFirstPacketInKeyFrame(vp9), vp9.ss_data_available); | |
2032 | |
2033 if (vp9.ss_data_available) | |
2034 EXPECT_EQ(kNumExpectedFramesInGof, vp9.gof.num_frames_in_gof); | |
2035 | |
2036 if (frames_sent_ > kNumFramesToSend) | |
2037 observation_complete_->Set(); | |
2038 } | |
2039 } test; | |
2040 | |
2041 RunBaseTest(&test, FakeNetworkPipe::Config()); | |
2042 } | |
2043 | |
2044 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_3Tl1SLayers) { | |
2045 static const size_t kNumFramesToSend = 100; | |
2046 static const size_t kNumExpectedFramesInGof = 4; | |
2047 class NonFlexibleMode : public Vp9HeaderObserver { | |
2048 void ModifyConfigsHook( | |
2049 VideoSendStream::Config* send_config, | |
2050 std::vector<VideoReceiveStream::Config>* receive_configs, | |
2051 VideoEncoderConfig* encoder_config) override { | |
2052 vp9_settings_.frameDroppingOn = false; | |
2053 vp9_settings_.flexibleMode = false; | |
2054 vp9_settings_.numberOfTemporalLayers = 3; | |
2055 vp9_settings_.numberOfSpatialLayers = 1; | |
2056 } | |
2057 | |
2058 void InspectHeader(const RTPVideoHeaderVP9& vp9) override { | |
2059 EXPECT_NE(kNoTl0PicIdx, vp9.tl0_pic_idx); | |
2060 EXPECT_GE(vp9.temporal_idx, 0); | |
2061 EXPECT_LE(vp9.temporal_idx, 2); | |
2062 EXPECT_EQ(0, vp9.spatial_idx); | |
2063 EXPECT_EQ(IsFirstPacketInKeyFrame(vp9), vp9.ss_data_available); | |
2064 | |
2065 if (vp9.ss_data_available) | |
2066 EXPECT_EQ(kNumExpectedFramesInGof, vp9.gof.num_frames_in_gof); | |
2067 | |
2068 if (frames_sent_ > kNumFramesToSend) | |
2069 observation_complete_->Set(); | |
2070 } | |
2071 } test; | |
2072 | |
2073 RunBaseTest(&test, FakeNetworkPipe::Config()); | |
2074 } | |
2075 | |
2076 | |
2077 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_1Tl2SLayers) { | |
2078 static const size_t kNumFramesToSend = 100; | |
2079 class NonFlexibleMode : public Vp9HeaderObserver { | |
2080 void ModifyConfigsHook( | |
2081 VideoSendStream::Config* send_config, | |
2082 std::vector<VideoReceiveStream::Config>* receive_configs, | |
2083 VideoEncoderConfig* encoder_config) override { | |
2084 vp9_settings_.frameDroppingOn = false; | |
2085 vp9_settings_.flexibleMode = false; | |
2086 vp9_settings_.numberOfTemporalLayers = 1; | |
2087 vp9_settings_.numberOfSpatialLayers = 2; | |
2088 } | |
2089 | |
2090 void InspectHeader(const RTPVideoHeaderVP9& vp9) override { | |
2091 EXPECT_NE(kNoTl0PicIdx, vp9.tl0_pic_idx); | |
2092 EXPECT_EQ(0, vp9.temporal_idx); | |
2093 EXPECT_EQ(IsFirstPacketInKeyFrame(vp9), vp9.ss_data_available); | |
2094 | |
2095 if (IsNewPictureId(vp9)) { | |
2096 EXPECT_EQ(0, vp9.spatial_idx); | |
2097 EXPECT_EQ(1, last_vp9_.spatial_idx); | |
2098 } | |
2099 if (frames_sent_ > kNumFramesToSend) | |
2100 observation_complete_->Set(); | |
2101 } | |
2102 } test; | |
2103 | |
2104 RunBaseTest(&test, FakeNetworkPipe::Config()); | |
2105 } | |
2106 | |
2107 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_2Tl2SLayers) { | |
2108 static const size_t kNumFramesToSend = 100; | |
2109 class NonFlexibleMode : public Vp9HeaderObserver { | |
2110 void ModifyConfigsHook( | |
2111 VideoSendStream::Config* send_config, | |
2112 std::vector<VideoReceiveStream::Config>* receive_configs, | |
2113 VideoEncoderConfig* encoder_config) override { | |
2114 vp9_settings_.frameDroppingOn = false; | |
2115 vp9_settings_.flexibleMode = false; | |
2116 vp9_settings_.numberOfTemporalLayers = 2; | |
2117 vp9_settings_.numberOfSpatialLayers = 2; | |
2118 vp9_settings_.keyFrameInterval = 50; | |
2119 } | |
2120 | |
2121 void InspectHeader(const RTPVideoHeaderVP9& vp9) override { | |
2122 EXPECT_NE(kNoTl0PicIdx, vp9.tl0_pic_idx); | |
2123 EXPECT_GE(vp9.temporal_idx, 0); | |
2124 EXPECT_LE(vp9.temporal_idx, 1); | |
2125 EXPECT_EQ(IsFirstPacketInKeyFrame(vp9), vp9.ss_data_available); | |
2126 | |
2127 if (IsNewPictureId(vp9)) { | |
2128 EXPECT_EQ(0, vp9.spatial_idx); | |
2129 EXPECT_EQ(1, last_vp9_.spatial_idx); | |
2130 } | |
2131 if (frames_sent_ > kNumFramesToSend) | |
2132 observation_complete_->Set(); | |
2133 } | |
2134 } test; | |
2135 | |
2136 RunBaseTest(&test, FakeNetworkPipe::Config()); | |
2137 } | |
2138 | |
2139 TEST_F(VideoSendStreamTest, Vp9FlexModeRefCount) { | |
2140 class FlexibleMode : public Vp9HeaderObserver { | |
2141 void ModifyConfigsHook( | |
2142 VideoSendStream::Config* send_config, | |
2143 std::vector<VideoReceiveStream::Config>* receive_configs, | |
2144 VideoEncoderConfig* encoder_config) override { | |
2145 encoder_config->content_type = VideoEncoderConfig::ContentType::kScreen; | |
1870 vp9_settings_.flexibleMode = true; | 2146 vp9_settings_.flexibleMode = true; |
1871 } | 2147 vp9_settings_.numberOfTemporalLayers = 1; |
1872 | 2148 vp9_settings_.numberOfSpatialLayers = 2; |
1873 void InspectHeader(RTPVideoHeaderVP9* vp9videoHeader) override { | 2149 } |
1874 EXPECT_TRUE(vp9videoHeader->flexible_mode); | 2150 |
1875 observation_complete_->Set(); | 2151 void InspectHeader(const RTPVideoHeaderVP9& vp9_header) override { |
1876 } | 2152 EXPECT_TRUE(vp9_header.flexible_mode); |
1877 } test; | 2153 EXPECT_EQ(kNoTl0PicIdx, vp9_header.tl0_pic_idx); |
1878 | 2154 if (vp9_header.inter_pic_predicted) { |
1879 RunBaseTest(&test, FakeNetworkPipe::Config()); | 2155 EXPECT_GT(vp9_header.num_ref_pics, 0u); |
1880 } | |
1881 | |
1882 TEST_F(VideoSendStreamTest, VP9FlexModeHasPictureId) { | |
1883 class FlexibleMode : public VP9HeaderObeserver { | |
1884 void ModifyConfigsHook( | |
1885 VideoSendStream::Config* send_config, | |
1886 std::vector<VideoReceiveStream::Config>* receive_configs, | |
1887 VideoEncoderConfig* encoder_config) override { | |
1888 vp9_settings_.flexibleMode = true; | |
1889 } | |
1890 | |
1891 void InspectHeader(RTPVideoHeaderVP9* vp9videoHeader) override { | |
1892 EXPECT_NE(vp9videoHeader->picture_id, kNoPictureId); | |
1893 observation_complete_->Set(); | |
1894 } | |
1895 } test; | |
1896 | |
1897 RunBaseTest(&test, FakeNetworkPipe::Config()); | |
1898 } | |
1899 | |
1900 TEST_F(VideoSendStreamTest, VP9FlexModeRefCount) { | |
1901 class FlexibleMode : public VP9HeaderObeserver { | |
1902 void ModifyConfigsHook( | |
1903 VideoSendStream::Config* send_config, | |
1904 std::vector<VideoReceiveStream::Config>* receive_configs, | |
1905 VideoEncoderConfig* encoder_config) override { | |
1906 vp9_settings_.flexibleMode = true; | |
1907 } | |
1908 | |
1909 void InspectHeader(RTPVideoHeaderVP9* vp9videoHeader) override { | |
1910 EXPECT_TRUE(vp9videoHeader->flexible_mode); | |
1911 if (vp9videoHeader->inter_pic_predicted) { | |
1912 EXPECT_GT(vp9videoHeader->num_ref_pics, 0u); | |
1913 observation_complete_->Set(); | 2156 observation_complete_->Set(); |
1914 } | 2157 } |
1915 } | 2158 } |
1916 } test; | 2159 } test; |
1917 | 2160 |
1918 RunBaseTest(&test, FakeNetworkPipe::Config()); | 2161 RunBaseTest(&test, FakeNetworkPipe::Config()); |
1919 } | |
1920 | |
1921 TEST_F(VideoSendStreamTest, VP9FlexModeRefs) { | |
1922 class FlexibleMode : public VP9HeaderObeserver { | |
1923 void ModifyConfigsHook( | |
1924 VideoSendStream::Config* send_config, | |
1925 std::vector<VideoReceiveStream::Config>* receive_configs, | |
1926 VideoEncoderConfig* encoder_config) override { | |
1927 vp9_settings_.flexibleMode = true; | |
1928 } | |
1929 | |
1930 void InspectHeader(RTPVideoHeaderVP9* vp9videoHeader) override { | |
1931 EXPECT_TRUE(vp9videoHeader->flexible_mode); | |
1932 if (vp9videoHeader->inter_pic_predicted) { | |
1933 EXPECT_GT(vp9videoHeader->num_ref_pics, 0u); | |
1934 observation_complete_->Set(); | |
1935 } | |
1936 } | |
1937 | |
1938 } test; | |
1939 | |
1940 RunBaseTest(&test, FakeNetworkPipe::Config()); | |
1941 } | 2162 } |
1942 | 2163 |
1943 } // namespace webrtc | 2164 } // namespace webrtc |
OLD | NEW |