| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 240   statistics_proxy_->CNameChanged(kName, kRemoteSsrc); | 240   statistics_proxy_->CNameChanged(kName, kRemoteSsrc); | 
| 241   EXPECT_STREQ(kName, statistics_proxy_->GetStats().c_name.c_str()); | 241   EXPECT_STREQ(kName, statistics_proxy_->GetStats().c_name.c_str()); | 
| 242 } | 242 } | 
| 243 | 243 | 
| 244 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsNoCNameForUnknownSsrc) { | 244 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsNoCNameForUnknownSsrc) { | 
| 245   const char* kName = "cName"; | 245   const char* kName = "cName"; | 
| 246   statistics_proxy_->CNameChanged(kName, kRemoteSsrc + 1); | 246   statistics_proxy_->CNameChanged(kName, kRemoteSsrc + 1); | 
| 247   EXPECT_STREQ("", statistics_proxy_->GetStats().c_name.c_str()); | 247   EXPECT_STREQ("", statistics_proxy_->GetStats().c_name.c_str()); | 
| 248 } | 248 } | 
| 249 | 249 | 
|  | 250 TEST_F(ReceiveStatisticsProxyTest, | 
|  | 251        GetTimingFrameInfoReportsLongestTimingFrame) { | 
|  | 252   const int64_t kShortEndToEndDelay = 10; | 
|  | 253   const int64_t kMedEndToEndDelay = 20; | 
|  | 254   const int64_t kLongEndToEndDelay = 100; | 
|  | 255   const uint32_t kExpectedRtpTimestamp = 2; | 
|  | 256   TimingFrameInfo info; | 
|  | 257   rtc::Optional<TimingFrameInfo> result; | 
|  | 258   info.rtp_timestamp = kExpectedRtpTimestamp - 1; | 
|  | 259   info.capture_time_ms = 0; | 
|  | 260   info.decode_finish_ms = kShortEndToEndDelay; | 
|  | 261   statistics_proxy_->OnTimingFrameInfoUpdated(info); | 
|  | 262   info.rtp_timestamp = | 
|  | 263       kExpectedRtpTimestamp;  // this frame should be reported in the end. | 
|  | 264   info.capture_time_ms = 0; | 
|  | 265   info.decode_finish_ms = kLongEndToEndDelay; | 
|  | 266   statistics_proxy_->OnTimingFrameInfoUpdated(info); | 
|  | 267   info.rtp_timestamp = kExpectedRtpTimestamp + 1; | 
|  | 268   info.capture_time_ms = 0; | 
|  | 269   info.decode_finish_ms = kMedEndToEndDelay; | 
|  | 270   statistics_proxy_->OnTimingFrameInfoUpdated(info); | 
|  | 271   result = statistics_proxy_->GetAndResetTimingFrameInfo(); | 
|  | 272   EXPECT_TRUE(result); | 
|  | 273   EXPECT_EQ(kExpectedRtpTimestamp, result->rtp_timestamp); | 
|  | 274 } | 
|  | 275 | 
|  | 276 TEST_F(ReceiveStatisticsProxyTest, GetTimingFrameInfoTimingFramesReportedOnce) { | 
|  | 277   const int64_t kShortEndToEndDelay = 10; | 
|  | 278   const uint32_t kExpectedRtpTimestamp = 2; | 
|  | 279   TimingFrameInfo info; | 
|  | 280   rtc::Optional<TimingFrameInfo> result; | 
|  | 281   info.rtp_timestamp = kExpectedRtpTimestamp; | 
|  | 282   info.capture_time_ms = 0; | 
|  | 283   info.decode_finish_ms = kShortEndToEndDelay; | 
|  | 284   statistics_proxy_->OnTimingFrameInfoUpdated(info); | 
|  | 285   result = statistics_proxy_->GetAndResetTimingFrameInfo(); | 
|  | 286   EXPECT_TRUE(result); | 
|  | 287   EXPECT_EQ(kExpectedRtpTimestamp, result->rtp_timestamp); | 
|  | 288   result = statistics_proxy_->GetAndResetTimingFrameInfo(); | 
|  | 289   EXPECT_FALSE(result); | 
|  | 290 } | 
|  | 291 | 
| 250 TEST_F(ReceiveStatisticsProxyTest, LifetimeHistogramIsUpdated) { | 292 TEST_F(ReceiveStatisticsProxyTest, LifetimeHistogramIsUpdated) { | 
| 251   const int64_t kTimeSec = 3; | 293   const int64_t kTimeSec = 3; | 
| 252   fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000); | 294   fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000); | 
| 253   // Histograms are updated when the statistics_proxy_ is deleted. | 295   // Histograms are updated when the statistics_proxy_ is deleted. | 
| 254   statistics_proxy_.reset(); | 296   statistics_proxy_.reset(); | 
| 255   EXPECT_EQ(1, | 297   EXPECT_EQ(1, | 
| 256             metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds")); | 298             metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds")); | 
| 257   EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.ReceiveStreamLifetimeInSeconds", | 299   EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.ReceiveStreamLifetimeInSeconds", | 
| 258                                   kTimeSec)); | 300                                   kTimeSec)); | 
| 259 } | 301 } | 
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 648                             kFirPackets * 60 / metrics::kMinRunTimeInSeconds)); | 690                             kFirPackets * 60 / metrics::kMinRunTimeInSeconds)); | 
| 649   EXPECT_EQ( | 691   EXPECT_EQ( | 
| 650       1, metrics::NumEvents("WebRTC.Video.PliPacketsSentPerMinute", | 692       1, metrics::NumEvents("WebRTC.Video.PliPacketsSentPerMinute", | 
| 651                             kPliPackets * 60 / metrics::kMinRunTimeInSeconds)); | 693                             kPliPackets * 60 / metrics::kMinRunTimeInSeconds)); | 
| 652   EXPECT_EQ( | 694   EXPECT_EQ( | 
| 653       1, metrics::NumEvents("WebRTC.Video.NackPacketsSentPerMinute", | 695       1, metrics::NumEvents("WebRTC.Video.NackPacketsSentPerMinute", | 
| 654                             kNackPackets * 60 / metrics::kMinRunTimeInSeconds)); | 696                             kNackPackets * 60 / metrics::kMinRunTimeInSeconds)); | 
| 655 } | 697 } | 
| 656 | 698 | 
| 657 }  // namespace webrtc | 699 }  // namespace webrtc | 
| OLD | NEW | 
|---|