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

Side by Side Diff: webrtc/video/send_statistics_proxy_unittest.cc

Issue 2136533002: Only update codec type histogram if lifetime is long enough (10 sec). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 4 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/video/send_statistics_proxy.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) 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // No switch, stats not should be updated. 295 // No switch, stats not should be updated.
296 statistics_proxy_->SetContentType( 296 statistics_proxy_->SetContentType(
297 VideoEncoderConfig::ContentType::kRealtimeVideo); 297 VideoEncoderConfig::ContentType::kRealtimeVideo);
298 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); 298 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels"));
299 299
300 // Switch to screenshare, real-time stats should be updated. 300 // Switch to screenshare, real-time stats should be updated.
301 statistics_proxy_->SetContentType(VideoEncoderConfig::ContentType::kScreen); 301 statistics_proxy_->SetContentType(VideoEncoderConfig::ContentType::kScreen);
302 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); 302 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InputWidthInPixels"));
303 } 303 }
304 304
305 TEST_F(SendStatisticsProxyTest, LifetimeHistogramIsUpdated) {
306 const int64_t kTimeSec = 3;
307 fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000);
308 statistics_proxy_.reset();
309 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.SendStreamLifetimeInSeconds"));
310 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.SendStreamLifetimeInSeconds",
311 kTimeSec));
312 }
313
314 TEST_F(SendStatisticsProxyTest, CodecTypeHistogramIsUpdated) {
315 fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000);
316 statistics_proxy_.reset();
317 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.Encoder.CodecType"));
318 }
319
305 TEST_F(SendStatisticsProxyTest, VerifyQpHistogramStats_Vp8) { 320 TEST_F(SendStatisticsProxyTest, VerifyQpHistogramStats_Vp8) {
306 EncodedImage encoded_image; 321 EncodedImage encoded_image;
307 CodecSpecificInfo codec_info; 322 CodecSpecificInfo codec_info;
308 codec_info.codecType = kVideoCodecVP8; 323 codec_info.codecType = kVideoCodecVP8;
309 324
310 for (int i = 0; i < kMinRequiredSamples; ++i) { 325 for (int i = 0; i < kMinRequiredSamples; ++i) {
311 codec_info.codecSpecific.VP8.simulcastIdx = 0; 326 codec_info.codecSpecific.VP8.simulcastIdx = 0;
312 encoded_image.qp_ = kQpIdx0; 327 encoded_image.qp_ = kQpIdx0;
313 statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info); 328 statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info);
314 codec_info.codecSpecific.VP8.simulcastIdx = 1; 329 codec_info.codecSpecific.VP8.simulcastIdx = 1;
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 735
721 EXPECT_EQ( 736 EXPECT_EQ(
722 1, metrics::NumSamples("WebRTC.Video.Screenshare.FecBitrateSentInKbps")); 737 1, metrics::NumSamples("WebRTC.Video.Screenshare.FecBitrateSentInKbps"));
723 EXPECT_EQ(1, metrics::NumEvents( 738 EXPECT_EQ(1, metrics::NumEvents(
724 "WebRTC.Video.Screenshare.FecBitrateSentInKbps", 739 "WebRTC.Video.Screenshare.FecBitrateSentInKbps",
725 static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) / 740 static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) /
726 metrics::kMinRunTimeInSeconds / 1000))); 741 metrics::kMinRunTimeInSeconds / 1000)));
727 } 742 }
728 743
729 } // namespace webrtc 744 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698