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 |
11 #include "webrtc/video/receive_statistics_proxy.h" | 11 #include "webrtc/video/receive_statistics_proxy.h" |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 | 14 |
| 15 #include "webrtc/api/video/video_frame.h" |
| 16 #include "webrtc/api/video/video_rotation.h" |
15 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 17 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
16 #include "webrtc/system_wrappers/include/metrics.h" | 18 #include "webrtc/system_wrappers/include/metrics.h" |
17 #include "webrtc/system_wrappers/include/metrics_default.h" | 19 #include "webrtc/system_wrappers/include/metrics_default.h" |
18 #include "webrtc/test/gtest.h" | 20 #include "webrtc/test/gtest.h" |
19 | 21 |
20 namespace webrtc { | 22 namespace webrtc { |
21 namespace { | 23 namespace { |
22 const int64_t kFreqOffsetProcessIntervalInMs = 40000; | 24 const int64_t kFreqOffsetProcessIntervalInMs = 40000; |
23 const uint32_t kLocalSsrc = 123; | 25 const uint32_t kLocalSsrc = 123; |
24 const uint32_t kRemoteSsrc = 456; | 26 const uint32_t kRemoteSsrc = 456; |
(...skipping 25 matching lines...) Expand all Loading... |
50 }; | 52 }; |
51 | 53 |
52 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesFramesDecoded) { | 54 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesFramesDecoded) { |
53 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded); | 55 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded); |
54 for (uint32_t i = 1; i <= 3; ++i) { | 56 for (uint32_t i = 1; i <= 3; ++i) { |
55 statistics_proxy_->OnDecodedFrame(); | 57 statistics_proxy_->OnDecodedFrame(); |
56 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded); | 58 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded); |
57 } | 59 } |
58 } | 60 } |
59 | 61 |
| 62 TEST_F(ReceiveStatisticsProxyTest, OnRenderedFrameIncreasesFramesRendered) { |
| 63 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_rendered); |
| 64 webrtc::VideoFrame frame( |
| 65 webrtc::I420Buffer::Create(1, 1), 0, 0, webrtc::kVideoRotation_0); |
| 66 for (uint32_t i = 1; i <= 3; ++i) { |
| 67 statistics_proxy_->OnRenderedFrame(frame); |
| 68 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_rendered); |
| 69 } |
| 70 } |
| 71 |
60 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsSsrc) { | 72 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsSsrc) { |
61 EXPECT_EQ(kRemoteSsrc, statistics_proxy_->GetStats().ssrc); | 73 EXPECT_EQ(kRemoteSsrc, statistics_proxy_->GetStats().ssrc); |
62 } | 74 } |
63 | 75 |
64 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsIncomingPayloadType) { | 76 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsIncomingPayloadType) { |
65 const int kPayloadType = 111; | 77 const int kPayloadType = 111; |
66 statistics_proxy_->OnIncomingPayloadType(kPayloadType); | 78 statistics_proxy_->OnIncomingPayloadType(kPayloadType); |
67 EXPECT_EQ(kPayloadType, statistics_proxy_->GetStats().current_payload_type); | 79 EXPECT_EQ(kPayloadType, statistics_proxy_->GetStats().current_payload_type); |
68 } | 80 } |
69 | 81 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 codec_info.codecType = kVideoCodecVP8; | 353 codec_info.codecType = kVideoCodecVP8; |
342 | 354 |
343 for (int i = 0; i < kMinRequiredSamples; ++i) | 355 for (int i = 0; i < kMinRequiredSamples; ++i) |
344 statistics_proxy_->OnPreDecode(encoded_image, &codec_info); | 356 statistics_proxy_->OnPreDecode(encoded_image, &codec_info); |
345 | 357 |
346 statistics_proxy_.reset(); | 358 statistics_proxy_.reset(); |
347 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); | 359 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); |
348 } | 360 } |
349 | 361 |
350 } // namespace webrtc | 362 } // namespace webrtc |
OLD | NEW |