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

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

Issue 1569853002: Measure encoding time on encode callbacks. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: asapersson@ feedback Created 4 years, 10 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 int avg_delay_ms = ssrc; 282 int avg_delay_ms = ssrc;
283 int max_delay_ms = ssrc + 1; 283 int max_delay_ms = ssrc + 1;
284 observer->SendSideDelayUpdated(avg_delay_ms, max_delay_ms, ssrc); 284 observer->SendSideDelayUpdated(avg_delay_ms, max_delay_ms, ssrc);
285 expected_.substreams[ssrc].avg_delay_ms = avg_delay_ms; 285 expected_.substreams[ssrc].avg_delay_ms = avg_delay_ms;
286 expected_.substreams[ssrc].max_delay_ms = max_delay_ms; 286 expected_.substreams[ssrc].max_delay_ms = max_delay_ms;
287 } 287 }
288 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); 288 VideoSendStream::Stats stats = statistics_proxy_->GetStats();
289 ExpectEqual(expected_, stats); 289 ExpectEqual(expected_, stats);
290 } 290 }
291 291
292 TEST_F(SendStatisticsProxyTest, OnEncodedFrame) { 292 TEST_F(SendStatisticsProxyTest, OnEncodedFrameTimeMeasured) {
293 const int kEncodeTimeMs = 11; 293 const int kEncodeTimeMs = 11;
294 statistics_proxy_->OnEncodedFrame(kEncodeTimeMs); 294 CpuOveruseMetrics metrics;
295 metrics.encode_usage_percent = 80;
296 statistics_proxy_->OnEncodedFrameTimeMeasured(kEncodeTimeMs, metrics);
295 297
296 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); 298 VideoSendStream::Stats stats = statistics_proxy_->GetStats();
297 EXPECT_EQ(kEncodeTimeMs, stats.avg_encode_time_ms); 299 EXPECT_EQ(kEncodeTimeMs, stats.avg_encode_time_ms);
300 EXPECT_EQ(metrics.encode_usage_percent, stats.encode_usage_percent);
298 } 301 }
299 302
300 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { 303 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) {
301 test::ClearHistograms(); 304 test::ClearHistograms();
302 const int kMinRequiredSamples = 200; 305 const int kMinRequiredSamples = 200;
303 const int kWidth = 640; 306 const int kWidth = 640;
304 const int kHeight = 480; 307 const int kHeight = 480;
305 308
306 for (int i = 0; i < kMinRequiredSamples; ++i) 309 for (int i = 0; i < kMinRequiredSamples; ++i)
307 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); 310 statistics_proxy_->OnIncomingFrame(kWidth, kHeight);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); 428 VideoSendStream::Stats stats = statistics_proxy_->GetStats();
426 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps), 429 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps),
427 stats.substreams[config_.rtp.ssrcs[0]].total_bitrate_bps); 430 stats.substreams[config_.rtp.ssrcs[0]].total_bitrate_bps);
428 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps), 431 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps),
429 stats.substreams[config_.rtp.ssrcs[0]].retransmit_bitrate_bps); 432 stats.substreams[config_.rtp.ssrcs[0]].retransmit_bitrate_bps);
430 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].total_bitrate_bps); 433 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].total_bitrate_bps);
431 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].retransmit_bitrate_bps); 434 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].retransmit_bitrate_bps);
432 } 435 }
433 436
434 } // namespace webrtc 437 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698