OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 CodecSpecificInfo codec_info; | 395 CodecSpecificInfo codec_info; |
396 codec_info.codecType = kVideoCodecVP8; | 396 codec_info.codecType = kVideoCodecVP8; |
397 | 397 |
398 for (int i = 0; i < kMinRequiredSamples; ++i) | 398 for (int i = 0; i < kMinRequiredSamples; ++i) |
399 statistics_proxy_->OnPreDecode(encoded_image, &codec_info); | 399 statistics_proxy_->OnPreDecode(encoded_image, &codec_info); |
400 | 400 |
401 statistics_proxy_.reset(); | 401 statistics_proxy_.reset(); |
402 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); | 402 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); |
403 } | 403 } |
404 | 404 |
| 405 TEST_F(ReceiveStatisticsProxyTest, |
| 406 KeyFrameHistogramNotUpdatedForTooFewSamples) { |
| 407 const bool kIsKeyFrame = false; |
| 408 const int kFrameSizeBytes = 1000; |
| 409 |
| 410 for (int i = 0; i < kMinRequiredSamples - 1; ++i) |
| 411 statistics_proxy_->OnCompleteFrame(kIsKeyFrame, kFrameSizeBytes); |
| 412 |
| 413 EXPECT_EQ(0, statistics_proxy_->GetStats().frame_counts.key_frames); |
| 414 EXPECT_EQ(kMinRequiredSamples - 1, |
| 415 statistics_proxy_->GetStats().frame_counts.delta_frames); |
| 416 |
| 417 statistics_proxy_.reset(); |
| 418 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille")); |
| 419 } |
| 420 |
| 421 TEST_F(ReceiveStatisticsProxyTest, |
| 422 KeyFrameHistogramUpdatedForMinRequiredSamples) { |
| 423 const bool kIsKeyFrame = false; |
| 424 const int kFrameSizeBytes = 1000; |
| 425 |
| 426 for (int i = 0; i < kMinRequiredSamples; ++i) |
| 427 statistics_proxy_->OnCompleteFrame(kIsKeyFrame, kFrameSizeBytes); |
| 428 |
| 429 EXPECT_EQ(0, statistics_proxy_->GetStats().frame_counts.key_frames); |
| 430 EXPECT_EQ(kMinRequiredSamples, |
| 431 statistics_proxy_->GetStats().frame_counts.delta_frames); |
| 432 |
| 433 statistics_proxy_.reset(); |
| 434 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille")); |
| 435 EXPECT_EQ(1, |
| 436 metrics::NumEvents("WebRTC.Video.KeyFramesReceivedInPermille", 0)); |
| 437 } |
| 438 |
| 439 TEST_F(ReceiveStatisticsProxyTest, KeyFrameHistogramIsUpdated) { |
| 440 const int kFrameSizeBytes = 1000; |
| 441 |
| 442 for (int i = 0; i < kMinRequiredSamples; ++i) |
| 443 statistics_proxy_->OnCompleteFrame(true, kFrameSizeBytes); |
| 444 |
| 445 for (int i = 0; i < kMinRequiredSamples; ++i) |
| 446 statistics_proxy_->OnCompleteFrame(false, kFrameSizeBytes); |
| 447 |
| 448 EXPECT_EQ(kMinRequiredSamples, |
| 449 statistics_proxy_->GetStats().frame_counts.key_frames); |
| 450 EXPECT_EQ(kMinRequiredSamples, |
| 451 statistics_proxy_->GetStats().frame_counts.delta_frames); |
| 452 |
| 453 statistics_proxy_.reset(); |
| 454 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille")); |
| 455 EXPECT_EQ( |
| 456 1, metrics::NumEvents("WebRTC.Video.KeyFramesReceivedInPermille", 500)); |
| 457 } |
| 458 |
| 459 TEST_F(ReceiveStatisticsProxyTest, TimingHistogramsNotUpdatedForTooFewSamples) { |
| 460 const int kDecodeMs = 1; |
| 461 const int kMaxDecodeMs = 2; |
| 462 const int kCurrentDelayMs = 3; |
| 463 const int kTargetDelayMs = 4; |
| 464 const int kJitterBufferMs = 5; |
| 465 const int kMinPlayoutDelayMs = 6; |
| 466 const int kRenderDelayMs = 7; |
| 467 |
| 468 for (int i = 0; i < kMinRequiredSamples - 1; ++i) { |
| 469 statistics_proxy_->OnFrameBufferTimingsUpdated( |
| 470 kDecodeMs, kMaxDecodeMs, kCurrentDelayMs, kTargetDelayMs, |
| 471 kJitterBufferMs, kMinPlayoutDelayMs, kRenderDelayMs); |
| 472 } |
| 473 |
| 474 statistics_proxy_.reset(); |
| 475 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.DecodeTimeInMs")); |
| 476 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.JitterBufferDelayInMs")); |
| 477 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.TargetDelayInMs")); |
| 478 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.CurrentDelayInMs")); |
| 479 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.OnewayDelayInMs")); |
| 480 } |
| 481 |
| 482 TEST_F(ReceiveStatisticsProxyTest, TimingHistogramsAreUpdated) { |
| 483 const int kDecodeMs = 1; |
| 484 const int kMaxDecodeMs = 2; |
| 485 const int kCurrentDelayMs = 3; |
| 486 const int kTargetDelayMs = 4; |
| 487 const int kJitterBufferMs = 5; |
| 488 const int kMinPlayoutDelayMs = 6; |
| 489 const int kRenderDelayMs = 7; |
| 490 |
| 491 for (int i = 0; i < kMinRequiredSamples; ++i) { |
| 492 statistics_proxy_->OnFrameBufferTimingsUpdated( |
| 493 kDecodeMs, kMaxDecodeMs, kCurrentDelayMs, kTargetDelayMs, |
| 494 kJitterBufferMs, kMinPlayoutDelayMs, kRenderDelayMs); |
| 495 } |
| 496 |
| 497 statistics_proxy_.reset(); |
| 498 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DecodeTimeInMs")); |
| 499 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.JitterBufferDelayInMs")); |
| 500 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.TargetDelayInMs")); |
| 501 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.CurrentDelayInMs")); |
| 502 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.OnewayDelayInMs")); |
| 503 |
| 504 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.DecodeTimeInMs", kDecodeMs)); |
| 505 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.JitterBufferDelayInMs", |
| 506 kJitterBufferMs)); |
| 507 EXPECT_EQ(1, |
| 508 metrics::NumEvents("WebRTC.Video.TargetDelayInMs", kTargetDelayMs)); |
| 509 EXPECT_EQ( |
| 510 1, metrics::NumEvents("WebRTC.Video.CurrentDelayInMs", kCurrentDelayMs)); |
| 511 EXPECT_EQ(1, |
| 512 metrics::NumEvents("WebRTC.Video.OnewayDelayInMs", kTargetDelayMs)); |
| 513 } |
| 514 |
405 } // namespace webrtc | 515 } // namespace webrtc |
OLD | NEW |