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

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: 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_Vp8) {
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(1, test::NumHistogramSamples("WebRTC.Video.Encoded.Qp.Vp8.S0"));
350 EXPECT_EQ(kQpIdx0,
351 test::LastHistogramSample("WebRTC.Video.Encoded.Qp.Vp8.S0"));
352 EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.Encoded.Qp.Vp8.S1"));
353 EXPECT_EQ(kQpIdx1,
354 test::LastHistogramSample("WebRTC.Video.Encoded.Qp.Vp8.S1"));
355 }
356
357 TEST_F(SendStatisticsProxyTest, VerifyQpHistogramStats_Vp8OneSsrc) {
358 VideoSendStream::Config config(nullptr);
359 config.rtp.ssrcs.push_back(kFirstSsrc);
360 statistics_proxy_.reset(new SendStatisticsProxy(
361 &fake_clock_, config, VideoEncoderConfig::ContentType::kRealtimeVideo));
362
363 test::ClearHistograms();
364 const int kMinRequiredSamples = 200;
365 const int kQpIdx0 = 21;
366 EncodedImage encoded_image;
367
368 RTPVideoHeader rtp_video_header;
369 rtp_video_header.codec = kRtpVideoVp8;
370
371 for (int i = 0; i < kMinRequiredSamples; ++i) {
372 rtp_video_header.simulcastIdx = 0;
373 encoded_image.qp_ = kQpIdx0;
374 statistics_proxy_->OnSendEncodedImage(encoded_image, &rtp_video_header);
375 }
376 statistics_proxy_.reset();
377 EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.Encoded.Qp.Vp8"));
378 EXPECT_EQ(kQpIdx0, test::LastHistogramSample("WebRTC.Video.Encoded.Qp.Vp8"));
379 }
380
330 TEST_F(SendStatisticsProxyTest, NoSubstreams) { 381 TEST_F(SendStatisticsProxyTest, NoSubstreams) {
331 uint32_t excluded_ssrc = 382 uint32_t excluded_ssrc =
332 std::max( 383 std::max(
333 *std::max_element(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end()), 384 *std::max_element(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end()),
334 *std::max_element(config_.rtp.rtx.ssrcs.begin(), 385 *std::max_element(config_.rtp.rtx.ssrcs.begin(),
335 config_.rtp.rtx.ssrcs.end())) + 386 config_.rtp.rtx.ssrcs.end())) +
336 1; 387 1;
337 // From RtcpStatisticsCallback. 388 // From RtcpStatisticsCallback.
338 RtcpStatistics rtcp_stats; 389 RtcpStatistics rtcp_stats;
339 RtcpStatisticsCallback* rtcp_callback = statistics_proxy_.get(); 390 RtcpStatisticsCallback* rtcp_callback = statistics_proxy_.get();
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 704
654 EXPECT_EQ(1, test::NumHistogramSamples( 705 EXPECT_EQ(1, test::NumHistogramSamples(
655 "WebRTC.Video.Screenshare.FecBitrateSentInKbps")); 706 "WebRTC.Video.Screenshare.FecBitrateSentInKbps"));
656 EXPECT_EQ(static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) / 707 EXPECT_EQ(static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) /
657 metrics::kMinRunTimeInSeconds / 1000), 708 metrics::kMinRunTimeInSeconds / 1000),
658 test::LastHistogramSample( 709 test::LastHistogramSample(
659 "WebRTC.Video.Screenshare.FecBitrateSentInKbps")); 710 "WebRTC.Video.Screenshare.FecBitrateSentInKbps"));
660 } 711 }
661 712
662 } // namespace webrtc 713 } // 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