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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 TEST_F(SendStatisticsProxyTest, OnSendEncodedImageIncreasesFramesEncoded) { | 304 TEST_F(SendStatisticsProxyTest, OnSendEncodedImageIncreasesFramesEncoded) { |
305 EncodedImage encoded_image; | 305 EncodedImage encoded_image; |
306 CodecSpecificInfo codec_info; | 306 CodecSpecificInfo codec_info; |
307 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_encoded); | 307 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_encoded); |
308 for (uint32_t i = 1; i <= 3; ++i) { | 308 for (uint32_t i = 1; i <= 3; ++i) { |
309 statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info); | 309 statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info); |
310 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_encoded); | 310 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_encoded); |
311 } | 311 } |
312 } | 312 } |
313 | 313 |
| 314 TEST_F(SendStatisticsProxyTest, OnSendEncodedImageIncreasesQpSum) { |
| 315 EncodedImage encoded_image; |
| 316 CodecSpecificInfo codec_info; |
| 317 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
| 318 encoded_image.qp_ = 3; |
| 319 statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info); |
| 320 EXPECT_EQ(rtc::Optional<uint64_t>(3u), statistics_proxy_->GetStats().qp_sum); |
| 321 encoded_image.qp_ = 127; |
| 322 statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info); |
| 323 EXPECT_EQ(rtc::Optional<uint64_t>(130u), |
| 324 statistics_proxy_->GetStats().qp_sum); |
| 325 } |
| 326 |
| 327 TEST_F(SendStatisticsProxyTest, OnSendEncodedImageWithoutQpQpSumWontExist) { |
| 328 EncodedImage encoded_image; |
| 329 CodecSpecificInfo codec_info; |
| 330 encoded_image.qp_ = -1; |
| 331 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
| 332 statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info); |
| 333 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
| 334 } |
| 335 |
314 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { | 336 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { |
315 const int kWidth = 640; | 337 const int kWidth = 640; |
316 const int kHeight = 480; | 338 const int kHeight = 480; |
317 | 339 |
318 for (int i = 0; i < kMinRequiredSamples; ++i) | 340 for (int i = 0; i < kMinRequiredSamples; ++i) |
319 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); | 341 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); |
320 | 342 |
321 // No switch, stats should not be updated. | 343 // No switch, stats should not be updated. |
322 VideoEncoderConfig config; | 344 VideoEncoderConfig config; |
323 config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo; | 345 config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo; |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 | 789 |
768 EXPECT_EQ( | 790 EXPECT_EQ( |
769 1, metrics::NumSamples("WebRTC.Video.Screenshare.FecBitrateSentInKbps")); | 791 1, metrics::NumSamples("WebRTC.Video.Screenshare.FecBitrateSentInKbps")); |
770 EXPECT_EQ(1, metrics::NumEvents( | 792 EXPECT_EQ(1, metrics::NumEvents( |
771 "WebRTC.Video.Screenshare.FecBitrateSentInKbps", | 793 "WebRTC.Video.Screenshare.FecBitrateSentInKbps", |
772 static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) / | 794 static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) / |
773 metrics::kMinRunTimeInSeconds / 1000))); | 795 metrics::kMinRunTimeInSeconds / 1000))); |
774 } | 796 } |
775 | 797 |
776 } // namespace webrtc | 798 } // namespace webrtc |
OLD | NEW |