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

Side by Side Diff: webrtc/stats/rtcstatscollector.cc

Issue 2290203002: Delete Timing class, timing.h, and update all users. (Closed)
Patch Set: Fix copy-paste error in rtpdataengine.cc. Created 4 years, 3 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
« no previous file with comments | « webrtc/media/base/rtpdataengine_unittest.cc ('k') | webrtc/stats/rtcstatscollector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/stats/rtcstatscollector.h" 11 #include "webrtc/stats/rtcstatscollector.h"
12 12
13 #include <memory> 13 #include <memory>
14 #include <utility> 14 #include <utility>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/api/peerconnection.h" 17 #include "webrtc/api/peerconnection.h"
18 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
19 #include "webrtc/base/timing.h"
20 19
21 namespace webrtc { 20 namespace webrtc {
22 21
23 rtc::scoped_refptr<RTCStatsCollector> RTCStatsCollector::Create( 22 rtc::scoped_refptr<RTCStatsCollector> RTCStatsCollector::Create(
24 PeerConnection* pc, int64_t cache_lifetime_us) { 23 PeerConnection* pc, int64_t cache_lifetime_us) {
25 return rtc::scoped_refptr<RTCStatsCollector>( 24 return rtc::scoped_refptr<RTCStatsCollector>(
26 new rtc::RefCountedObject<RTCStatsCollector>(pc, cache_lifetime_us)); 25 new rtc::RefCountedObject<RTCStatsCollector>(pc, cache_lifetime_us));
27 } 26 }
28 27
29 RTCStatsCollector::RTCStatsCollector(PeerConnection* pc, 28 RTCStatsCollector::RTCStatsCollector(PeerConnection* pc,
(...skipping 26 matching lines...) Expand all
56 // We have a fresh cached report to deliver. 55 // We have a fresh cached report to deliver.
57 DeliverCachedReport(); 56 DeliverCachedReport();
58 } else if (!num_pending_partial_reports_) { 57 } else if (!num_pending_partial_reports_) {
59 // Only start gathering stats if we're not already gathering stats. In the 58 // Only start gathering stats if we're not already gathering stats. In the
60 // case of already gathering stats, |callback_| will be invoked when there 59 // case of already gathering stats, |callback_| will be invoked when there
61 // are no more pending partial reports. 60 // are no more pending partial reports.
62 61
63 // "Now" using a system clock, relative to the UNIX epoch (Jan 1, 1970, 62 // "Now" using a system clock, relative to the UNIX epoch (Jan 1, 1970,
64 // UTC), in microseconds. The system clock could be modified and is not 63 // UTC), in microseconds. The system clock could be modified and is not
65 // necessarily monotonically increasing. 64 // necessarily monotonically increasing.
66 int64_t timestamp_us = static_cast<int64_t>( 65 int64_t timestamp_us = rtc::TimeUTCMicros();
67 rtc::Timing::WallTimeNow() * rtc::kNumMicrosecsPerSec);
68 66
69 num_pending_partial_reports_ = 3; 67 num_pending_partial_reports_ = 3;
70 partial_report_timestamp_us_ = cache_now_us; 68 partial_report_timestamp_us_ = cache_now_us;
71 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_, 69 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_,
72 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnSignalingThread, 70 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnSignalingThread,
73 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); 71 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us));
74 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, worker_thread_, 72 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, worker_thread_,
75 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnWorkerThread, 73 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnWorkerThread,
76 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); 74 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us));
77 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, network_thread_, 75 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, network_thread_,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // constant. 170 // constant.
173 std::unique_ptr<RTCPeerConnectionStats> stats( 171 std::unique_ptr<RTCPeerConnectionStats> stats(
174 new RTCPeerConnectionStats("RTCPeerConnection", timestamp_us)); 172 new RTCPeerConnectionStats("RTCPeerConnection", timestamp_us));
175 stats->data_channels_opened = data_channels_opened; 173 stats->data_channels_opened = data_channels_opened;
176 stats->data_channels_closed = static_cast<uint32_t>(data_channels.size()) - 174 stats->data_channels_closed = static_cast<uint32_t>(data_channels.size()) -
177 data_channels_opened; 175 data_channels_opened;
178 return stats; 176 return stats;
179 } 177 }
180 178
181 } // namespace webrtc 179 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/media/base/rtpdataengine_unittest.cc ('k') | webrtc/stats/rtcstatscollector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698