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 | 10 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 statistics_proxy_->OnEncoderReconfigured(config, kPreferredMediaBitrateBps); | 298 statistics_proxy_->OnEncoderReconfigured(config, kPreferredMediaBitrateBps); |
299 stats = statistics_proxy_->GetStats(); | 299 stats = statistics_proxy_->GetStats(); |
300 EXPECT_EQ(kPreferredMediaBitrateBps, stats.preferred_media_bitrate_bps); | 300 EXPECT_EQ(kPreferredMediaBitrateBps, stats.preferred_media_bitrate_bps); |
301 } | 301 } |
302 | 302 |
303 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { | 303 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { |
304 const int kWidth = 640; | 304 const int kWidth = 640; |
305 const int kHeight = 480; | 305 const int kHeight = 480; |
306 | 306 |
307 for (int i = 0; i < SendStatisticsProxy::kMinRequiredUMASamples; ++i) | 307 for (int i = 0; i < SendStatisticsProxy::kMinRequiredUMASamples; ++i) |
308 statistics_proxy_->OnIncomingFrame(kWidth, kHeight, false); | 308 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); |
309 | 309 |
310 // No switch, stats should not be updated. | 310 // No switch, stats should not be updated. |
311 VideoEncoderConfig config; | 311 VideoEncoderConfig config; |
312 config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo; | 312 config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo; |
313 statistics_proxy_->OnEncoderReconfigured(config, 50); | 313 statistics_proxy_->OnEncoderReconfigured(config, 50); |
314 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); | 314 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); |
315 | 315 |
316 // Switch to screenshare, real-time stats should be updated. | 316 // Switch to screenshare, real-time stats should be updated. |
317 config.content_type = VideoEncoderConfig::ContentType::kScreen; | 317 config.content_type = VideoEncoderConfig::ContentType::kScreen; |
318 statistics_proxy_->OnEncoderReconfigured(config, 50); | 318 statistics_proxy_->OnEncoderReconfigured(config, 50); |
319 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); | 319 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); |
320 } | 320 } |
321 | 321 |
322 TEST_F(SendStatisticsProxyTest, CpuLimitedResolutionUpdated) { | 322 TEST_F(SendStatisticsProxyTest, CpuLimitedResolutionUpdated) { |
323 const int kWidth = 640; | 323 const int kWidth = 640; |
324 const int kHeight = 480; | 324 const int kHeight = 480; |
325 | 325 |
326 for (int i = 0; i < SendStatisticsProxy::kMinRequiredUMASamples; ++i) | 326 for (int i = 0; i < SendStatisticsProxy::kMinRequiredUMASamples; ++i) |
327 statistics_proxy_->OnIncomingFrame(kWidth, kHeight, false); | 327 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); |
| 328 |
| 329 statistics_proxy_->OnCpuRestrictedResolutionChanged(true); |
328 | 330 |
329 for (int i = 0; i < SendStatisticsProxy::kMinRequiredUMASamples; ++i) | 331 for (int i = 0; i < SendStatisticsProxy::kMinRequiredUMASamples; ++i) |
330 statistics_proxy_->OnIncomingFrame(kWidth, kHeight, true); | 332 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); |
331 | 333 |
332 statistics_proxy_.reset(); | 334 statistics_proxy_.reset(); |
333 EXPECT_EQ(1, | 335 EXPECT_EQ(1, |
334 metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent")); | 336 metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent")); |
335 EXPECT_EQ( | 337 EXPECT_EQ( |
336 1, metrics::NumEvents("WebRTC.Video.CpuLimitedResolutionInPercent", 50)); | 338 1, metrics::NumEvents("WebRTC.Video.CpuLimitedResolutionInPercent", 50)); |
337 } | 339 } |
338 | 340 |
339 TEST_F(SendStatisticsProxyTest, LifetimeHistogramIsUpdated) { | 341 TEST_F(SendStatisticsProxyTest, LifetimeHistogramIsUpdated) { |
340 const int64_t kTimeSec = 3; | 342 const int64_t kTimeSec = 3; |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 | 775 |
774 EXPECT_EQ( | 776 EXPECT_EQ( |
775 1, metrics::NumSamples("WebRTC.Video.Screenshare.FecBitrateSentInKbps")); | 777 1, metrics::NumSamples("WebRTC.Video.Screenshare.FecBitrateSentInKbps")); |
776 EXPECT_EQ(1, metrics::NumEvents( | 778 EXPECT_EQ(1, metrics::NumEvents( |
777 "WebRTC.Video.Screenshare.FecBitrateSentInKbps", | 779 "WebRTC.Video.Screenshare.FecBitrateSentInKbps", |
778 static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) / | 780 static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) / |
779 metrics::kMinRunTimeInSeconds / 1000))); | 781 metrics::kMinRunTimeInSeconds / 1000))); |
780 } | 782 } |
781 | 783 |
782 } // namespace webrtc | 784 } // namespace webrtc |
OLD | NEW |