| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 EXPECT_EQ(kPayloadType, statistics_proxy_->GetStats().current_payload_type); | 79 EXPECT_EQ(kPayloadType, statistics_proxy_->GetStats().current_payload_type); |
| 80 } | 80 } |
| 81 | 81 |
| 82 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsDecoderImplementationName) { | 82 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsDecoderImplementationName) { |
| 83 const char* kName = "decoderName"; | 83 const char* kName = "decoderName"; |
| 84 statistics_proxy_->OnDecoderImplementationName(kName); | 84 statistics_proxy_->OnDecoderImplementationName(kName); |
| 85 EXPECT_STREQ( | 85 EXPECT_STREQ( |
| 86 kName, statistics_proxy_->GetStats().decoder_implementation_name.c_str()); | 86 kName, statistics_proxy_->GetStats().decoder_implementation_name.c_str()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsOnCompleteFrame) { | 89 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsIncomingRate) { |
| 90 const int kFrameSizeBytes = 1000; | 90 const int kFramerate = 28; |
| 91 statistics_proxy_->OnCompleteFrame(true, kFrameSizeBytes); | 91 const int kBitrateBps = 311000; |
| 92 VideoReceiveStream::Stats stats = statistics_proxy_->GetStats(); | 92 statistics_proxy_->OnIncomingRate(kFramerate, kBitrateBps); |
| 93 EXPECT_EQ(1, stats.network_frame_rate); | 93 EXPECT_EQ(kFramerate, statistics_proxy_->GetStats().network_frame_rate); |
| 94 EXPECT_EQ(kFrameSizeBytes * 8, stats.total_bitrate_bps); | 94 EXPECT_EQ(kBitrateBps, statistics_proxy_->GetStats().total_bitrate_bps); |
| 95 EXPECT_EQ(1, stats.frame_counts.key_frames); | |
| 96 EXPECT_EQ(0, stats.frame_counts.delta_frames); | |
| 97 } | 95 } |
| 98 | 96 |
| 99 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsDecodeTimingStats) { | 97 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsDecodeTimingStats) { |
| 100 const int kDecodeMs = 1; | 98 const int kDecodeMs = 1; |
| 101 const int kMaxDecodeMs = 2; | 99 const int kMaxDecodeMs = 2; |
| 102 const int kCurrentDelayMs = 3; | 100 const int kCurrentDelayMs = 3; |
| 103 const int kTargetDelayMs = 4; | 101 const int kTargetDelayMs = 4; |
| 104 const int kJitterBufferMs = 5; | 102 const int kJitterBufferMs = 5; |
| 105 const int kMinPlayoutDelayMs = 6; | 103 const int kMinPlayoutDelayMs = 6; |
| 106 const int kRenderDelayMs = 7; | 104 const int kRenderDelayMs = 7; |
| 107 const int64_t kRttMs = 8; | 105 const int64_t kRttMs = 8; |
| 108 statistics_proxy_->OnRttUpdate(kRttMs, 0); | 106 statistics_proxy_->OnDecoderTiming( |
| 109 statistics_proxy_->OnFrameBufferTimingsUpdated( | |
| 110 kDecodeMs, kMaxDecodeMs, kCurrentDelayMs, kTargetDelayMs, kJitterBufferMs, | 107 kDecodeMs, kMaxDecodeMs, kCurrentDelayMs, kTargetDelayMs, kJitterBufferMs, |
| 111 kMinPlayoutDelayMs, kRenderDelayMs); | 108 kMinPlayoutDelayMs, kRenderDelayMs, kRttMs); |
| 112 VideoReceiveStream::Stats stats = statistics_proxy_->GetStats(); | 109 VideoReceiveStream::Stats stats = statistics_proxy_->GetStats(); |
| 113 EXPECT_EQ(kDecodeMs, stats.decode_ms); | 110 EXPECT_EQ(kDecodeMs, stats.decode_ms); |
| 114 EXPECT_EQ(kMaxDecodeMs, stats.max_decode_ms); | 111 EXPECT_EQ(kMaxDecodeMs, stats.max_decode_ms); |
| 115 EXPECT_EQ(kCurrentDelayMs, stats.current_delay_ms); | 112 EXPECT_EQ(kCurrentDelayMs, stats.current_delay_ms); |
| 116 EXPECT_EQ(kTargetDelayMs, stats.target_delay_ms); | 113 EXPECT_EQ(kTargetDelayMs, stats.target_delay_ms); |
| 117 EXPECT_EQ(kJitterBufferMs, stats.jitter_buffer_ms); | 114 EXPECT_EQ(kJitterBufferMs, stats.jitter_buffer_ms); |
| 118 EXPECT_EQ(kMinPlayoutDelayMs, stats.min_playout_delay_ms); | 115 EXPECT_EQ(kMinPlayoutDelayMs, stats.min_playout_delay_ms); |
| 119 EXPECT_EQ(kRenderDelayMs, stats.render_delay_ms); | 116 EXPECT_EQ(kRenderDelayMs, stats.render_delay_ms); |
| 120 } | 117 } |
| 121 | 118 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 codec_info.codecType = kVideoCodecVP8; | 353 codec_info.codecType = kVideoCodecVP8; |
| 357 | 354 |
| 358 for (int i = 0; i < kMinRequiredSamples; ++i) | 355 for (int i = 0; i < kMinRequiredSamples; ++i) |
| 359 statistics_proxy_->OnPreDecode(encoded_image, &codec_info); | 356 statistics_proxy_->OnPreDecode(encoded_image, &codec_info); |
| 360 | 357 |
| 361 statistics_proxy_.reset(); | 358 statistics_proxy_.reset(); |
| 362 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); | 359 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); |
| 363 } | 360 } |
| 364 | 361 |
| 365 } // namespace webrtc | 362 } // namespace webrtc |
| OLD | NEW |