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

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

Issue 1523293002: Add histogram stats for average QP per frame for VP8 (for sent video streams): (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 9 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
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // No switch, stats not should be updated. 320 // No switch, stats not should be updated.
321 statistics_proxy_->SetContentType( 321 statistics_proxy_->SetContentType(
322 VideoEncoderConfig::ContentType::kRealtimeVideo); 322 VideoEncoderConfig::ContentType::kRealtimeVideo);
323 EXPECT_EQ(0, test::NumHistogramSamples("WebRTC.Video.InputWidthInPixels")); 323 EXPECT_EQ(0, test::NumHistogramSamples("WebRTC.Video.InputWidthInPixels"));
324 324
325 // Switch to screenshare, real-time stats should be updated. 325 // Switch to screenshare, real-time stats should be updated.
326 statistics_proxy_->SetContentType(VideoEncoderConfig::ContentType::kScreen); 326 statistics_proxy_->SetContentType(VideoEncoderConfig::ContentType::kScreen);
327 EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.InputWidthInPixels")); 327 EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.InputWidthInPixels"));
328 } 328 }
329 329
330 TEST_F(SendStatisticsProxyTest, VerifyQpHistogramStats) {
331 test::ClearHistograms();
332 const int kMinRequiredSamples = 200;
333 const int kQpIdx0 = 21;
334 const int kQpIdx1 = 39;
335 EncodedImage encoded_image;
336
337 RTPVideoHeader rtp_video_header;
338 rtp_video_header.codec = kRtpVideoVp8;
339
340 for (int i = 0; i < kMinRequiredSamples; ++i) {
341 rtp_video_header.simulcastIdx = 0;
342 encoded_image.qp_ = kQpIdx0;
343 statistics_proxy_->OnSendEncodedImage(encoded_image, &rtp_video_header);
344 rtp_video_header.simulcastIdx = 1;
345 encoded_image.qp_ = kQpIdx1;
346 statistics_proxy_->OnSendEncodedImage(encoded_image, &rtp_video_header);
347 }
348 statistics_proxy_.reset();
349 EXPECT_EQ(2, test::NumHistogramSamples("WebRTC.Video.Encoded.Qp.Vp8"));
350 EXPECT_EQ(kQpIdx1, test::LastHistogramSample("WebRTC.Video.Encoded.Qp.Vp8"));
stefan-webrtc 2016/03/22 15:12:46 Shouldn't this be the average of 21 and 39?
åsapersson 2016/03/22 15:29:46 QP is stored per ssrc e.g. two qp samples should b
351 }
352
330 TEST_F(SendStatisticsProxyTest, NoSubstreams) { 353 TEST_F(SendStatisticsProxyTest, NoSubstreams) {
331 uint32_t excluded_ssrc = 354 uint32_t excluded_ssrc =
332 std::max( 355 std::max(
333 *std::max_element(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end()), 356 *std::max_element(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end()),
334 *std::max_element(config_.rtp.rtx.ssrcs.begin(), 357 *std::max_element(config_.rtp.rtx.ssrcs.begin(),
335 config_.rtp.rtx.ssrcs.end())) + 358 config_.rtp.rtx.ssrcs.end())) +
336 1; 359 1;
337 // From RtcpStatisticsCallback. 360 // From RtcpStatisticsCallback.
338 RtcpStatistics rtcp_stats; 361 RtcpStatistics rtcp_stats;
339 RtcpStatisticsCallback* rtcp_callback = statistics_proxy_.get(); 362 RtcpStatisticsCallback* rtcp_callback = statistics_proxy_.get();
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 676
654 EXPECT_EQ(1, test::NumHistogramSamples( 677 EXPECT_EQ(1, test::NumHistogramSamples(
655 "WebRTC.Video.Screenshare.FecBitrateSentInKbps")); 678 "WebRTC.Video.Screenshare.FecBitrateSentInKbps"));
656 EXPECT_EQ(static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) / 679 EXPECT_EQ(static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) /
657 metrics::kMinRunTimeInSeconds / 1000), 680 metrics::kMinRunTimeInSeconds / 1000),
658 test::LastHistogramSample( 681 test::LastHistogramSample(
659 "WebRTC.Video.Screenshare.FecBitrateSentInKbps")); 682 "WebRTC.Video.Screenshare.FecBitrateSentInKbps"));
660 } 683 }
661 684
662 } // namespace webrtc 685 } // namespace webrtc
OLDNEW
« webrtc/video/send_statistics_proxy.cc ('K') | « webrtc/video/send_statistics_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698