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 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2137 const uint8_t kNumSpatialLayers = 1; | 2137 const uint8_t kNumSpatialLayers = 1; |
2138 TestVp9NonFlexMode(kNumTemporalLayers, kNumSpatialLayers); | 2138 TestVp9NonFlexMode(kNumTemporalLayers, kNumSpatialLayers); |
2139 } | 2139 } |
2140 | 2140 |
2141 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_1Tl2SLayers) { | 2141 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_1Tl2SLayers) { |
2142 const uint8_t kNumTemporalLayers = 1; | 2142 const uint8_t kNumTemporalLayers = 1; |
2143 const uint8_t kNumSpatialLayers = 2; | 2143 const uint8_t kNumSpatialLayers = 2; |
2144 TestVp9NonFlexMode(kNumTemporalLayers, kNumSpatialLayers); | 2144 TestVp9NonFlexMode(kNumTemporalLayers, kNumSpatialLayers); |
2145 } | 2145 } |
2146 | 2146 |
| 2147 #if !defined(MEMORY_SANITIZER) |
| 2148 // Fails under MemorySanitizer: |
| 2149 // See https://code.google.com/p/webrtc/issues/detail?id=5402. |
2147 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_2Tl2SLayers) { | 2150 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_2Tl2SLayers) { |
2148 const uint8_t kNumTemporalLayers = 2; | 2151 const uint8_t kNumTemporalLayers = 2; |
2149 const uint8_t kNumSpatialLayers = 2; | 2152 const uint8_t kNumSpatialLayers = 2; |
2150 TestVp9NonFlexMode(kNumTemporalLayers, kNumSpatialLayers); | 2153 TestVp9NonFlexMode(kNumTemporalLayers, kNumSpatialLayers); |
2151 } | 2154 } |
2152 | 2155 |
2153 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_3Tl2SLayers) { | 2156 TEST_F(VideoSendStreamTest, Vp9NonFlexMode_3Tl2SLayers) { |
2154 const uint8_t kNumTemporalLayers = 3; | 2157 const uint8_t kNumTemporalLayers = 3; |
2155 const uint8_t kNumSpatialLayers = 2; | 2158 const uint8_t kNumSpatialLayers = 2; |
2156 TestVp9NonFlexMode(kNumTemporalLayers, kNumSpatialLayers); | 2159 TestVp9NonFlexMode(kNumTemporalLayers, kNumSpatialLayers); |
2157 } | 2160 } |
| 2161 #endif |
2158 | 2162 |
2159 void VideoSendStreamTest::TestVp9NonFlexMode(uint8_t num_temporal_layers, | 2163 void VideoSendStreamTest::TestVp9NonFlexMode(uint8_t num_temporal_layers, |
2160 uint8_t num_spatial_layers) { | 2164 uint8_t num_spatial_layers) { |
2161 static const size_t kNumFramesToSend = 100; | 2165 static const size_t kNumFramesToSend = 100; |
2162 // Set to < kNumFramesToSend and coprime to length of temporal layer | 2166 // Set to < kNumFramesToSend and coprime to length of temporal layer |
2163 // structures to verify temporal id reset on key frame. | 2167 // structures to verify temporal id reset on key frame. |
2164 static const int kKeyFrameInterval = 31; | 2168 static const int kKeyFrameInterval = 31; |
2165 class NonFlexibleMode : public Vp9HeaderObserver { | 2169 class NonFlexibleMode : public Vp9HeaderObserver { |
2166 public: | 2170 public: |
2167 NonFlexibleMode(uint8_t num_temporal_layers, uint8_t num_spatial_layers) | 2171 NonFlexibleMode(uint8_t num_temporal_layers, uint8_t num_spatial_layers) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 observation_complete_.Set(); | 2203 observation_complete_.Set(); |
2200 } | 2204 } |
2201 const uint8_t num_temporal_layers_; | 2205 const uint8_t num_temporal_layers_; |
2202 const uint8_t num_spatial_layers_; | 2206 const uint8_t num_spatial_layers_; |
2203 const bool l_field_; | 2207 const bool l_field_; |
2204 } test(num_temporal_layers, num_spatial_layers); | 2208 } test(num_temporal_layers, num_spatial_layers); |
2205 | 2209 |
2206 RunBaseTest(&test, FakeNetworkPipe::Config()); | 2210 RunBaseTest(&test, FakeNetworkPipe::Config()); |
2207 } | 2211 } |
2208 | 2212 |
| 2213 #if !defined(MEMORY_SANITIZER) |
| 2214 // Fails under MemorySanitizer: |
| 2215 // See https://code.google.com/p/webrtc/issues/detail?id=5402. |
2209 TEST_F(VideoSendStreamTest, Vp9FlexModeRefCount) { | 2216 TEST_F(VideoSendStreamTest, Vp9FlexModeRefCount) { |
2210 class FlexibleMode : public Vp9HeaderObserver { | 2217 class FlexibleMode : public Vp9HeaderObserver { |
2211 void ModifyVideoConfigsHook( | 2218 void ModifyVideoConfigsHook( |
2212 VideoSendStream::Config* send_config, | 2219 VideoSendStream::Config* send_config, |
2213 std::vector<VideoReceiveStream::Config>* receive_configs, | 2220 std::vector<VideoReceiveStream::Config>* receive_configs, |
2214 VideoEncoderConfig* encoder_config) override { | 2221 VideoEncoderConfig* encoder_config) override { |
2215 encoder_config->content_type = VideoEncoderConfig::ContentType::kScreen; | 2222 encoder_config->content_type = VideoEncoderConfig::ContentType::kScreen; |
2216 vp9_settings_.flexibleMode = true; | 2223 vp9_settings_.flexibleMode = true; |
2217 vp9_settings_.numberOfTemporalLayers = 1; | 2224 vp9_settings_.numberOfTemporalLayers = 1; |
2218 vp9_settings_.numberOfSpatialLayers = 2; | 2225 vp9_settings_.numberOfSpatialLayers = 2; |
2219 } | 2226 } |
2220 | 2227 |
2221 void InspectHeader(const RTPVideoHeaderVP9& vp9_header) override { | 2228 void InspectHeader(const RTPVideoHeaderVP9& vp9_header) override { |
2222 EXPECT_TRUE(vp9_header.flexible_mode); | 2229 EXPECT_TRUE(vp9_header.flexible_mode); |
2223 EXPECT_EQ(kNoTl0PicIdx, vp9_header.tl0_pic_idx); | 2230 EXPECT_EQ(kNoTl0PicIdx, vp9_header.tl0_pic_idx); |
2224 if (vp9_header.inter_pic_predicted) { | 2231 if (vp9_header.inter_pic_predicted) { |
2225 EXPECT_GT(vp9_header.num_ref_pics, 0u); | 2232 EXPECT_GT(vp9_header.num_ref_pics, 0u); |
2226 observation_complete_.Set(); | 2233 observation_complete_.Set(); |
2227 } | 2234 } |
2228 } | 2235 } |
2229 } test; | 2236 } test; |
2230 | 2237 |
2231 RunBaseTest(&test, FakeNetworkPipe::Config()); | 2238 RunBaseTest(&test, FakeNetworkPipe::Config()); |
2232 } | 2239 } |
| 2240 #endif |
2233 | 2241 |
2234 } // namespace webrtc | 2242 } // namespace webrtc |
OLD | NEW |