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

Side by Side Diff: webrtc/video_engine/call_stats.h

Issue 1512853002: Nuke TickTime::UseFakeClock. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback Created 5 years 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/test/fake_network_pipe_unittest.cc ('k') | webrtc/video_engine/call_stats.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 (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 #ifndef WEBRTC_VIDEO_ENGINE_CALL_STATS_H_ 11 #ifndef WEBRTC_VIDEO_ENGINE_CALL_STATS_H_
12 #define WEBRTC_VIDEO_ENGINE_CALL_STATS_H_ 12 #define WEBRTC_VIDEO_ENGINE_CALL_STATS_H_
13 13
14 #include <list> 14 #include <list>
15 15
16 #include "webrtc/base/constructormagic.h" 16 #include "webrtc/base/constructormagic.h"
17 #include "webrtc/base/scoped_ptr.h" 17 #include "webrtc/base/scoped_ptr.h"
18 #include "webrtc/modules/include/module.h" 18 #include "webrtc/modules/include/module.h"
19 #include "webrtc/system_wrappers/include/clock.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 22
22 class CallStatsObserver; 23 class CallStatsObserver;
23 class CriticalSectionWrapper; 24 class CriticalSectionWrapper;
24 class RtcpRttStats; 25 class RtcpRttStats;
25 26
26 // CallStats keeps track of statistics for a call. 27 // CallStats keeps track of statistics for a call.
27 class CallStats : public Module { 28 class CallStats : public Module {
28 public: 29 public:
29 friend class RtcpObserver; 30 friend class RtcpObserver;
30 31
31 CallStats(); 32 explicit CallStats(Clock* clock);
32 ~CallStats(); 33 ~CallStats();
33 34
34 // Implements Module, to use the process thread. 35 // Implements Module, to use the process thread.
35 int64_t TimeUntilNextProcess() override; 36 int64_t TimeUntilNextProcess() override;
36 int32_t Process() override; 37 int32_t Process() override;
37 38
38 // Returns a RtcpRttStats to register at a statistics provider. The object 39 // Returns a RtcpRttStats to register at a statistics provider. The object
39 // has the same lifetime as the CallStats instance. 40 // has the same lifetime as the CallStats instance.
40 RtcpRttStats* rtcp_rtt_stats() const; 41 RtcpRttStats* rtcp_rtt_stats() const;
41 42
42 // Registers/deregisters a new observer to receive statistics updates. 43 // Registers/deregisters a new observer to receive statistics updates.
43 void RegisterStatsObserver(CallStatsObserver* observer); 44 void RegisterStatsObserver(CallStatsObserver* observer);
44 void DeregisterStatsObserver(CallStatsObserver* observer); 45 void DeregisterStatsObserver(CallStatsObserver* observer);
45 46
46 // Helper struct keeping track of the time a rtt value is reported. 47 // Helper struct keeping track of the time a rtt value is reported.
47 struct RttTime { 48 struct RttTime {
48 RttTime(int64_t new_rtt, int64_t rtt_time) 49 RttTime(int64_t new_rtt, int64_t rtt_time)
49 : rtt(new_rtt), time(rtt_time) {} 50 : rtt(new_rtt), time(rtt_time) {}
50 const int64_t rtt; 51 const int64_t rtt;
51 const int64_t time; 52 const int64_t time;
52 }; 53 };
53 54
54 protected: 55 protected:
55 void OnRttUpdate(int64_t rtt); 56 void OnRttUpdate(int64_t rtt);
56 57
57 int64_t avg_rtt_ms() const; 58 int64_t avg_rtt_ms() const;
58 59
59 private: 60 private:
61 Clock* const clock_;
60 // Protecting all members. 62 // Protecting all members.
61 rtc::scoped_ptr<CriticalSectionWrapper> crit_; 63 rtc::scoped_ptr<CriticalSectionWrapper> crit_;
62 // Observer receiving statistics updates. 64 // Observer receiving statistics updates.
63 rtc::scoped_ptr<RtcpRttStats> rtcp_rtt_stats_; 65 rtc::scoped_ptr<RtcpRttStats> rtcp_rtt_stats_;
64 // The last time 'Process' resulted in statistic update. 66 // The last time 'Process' resulted in statistic update.
65 int64_t last_process_time_; 67 int64_t last_process_time_;
66 // The last RTT in the statistics update (zero if there is no valid estimate). 68 // The last RTT in the statistics update (zero if there is no valid estimate).
67 int64_t max_rtt_ms_; 69 int64_t max_rtt_ms_;
68 int64_t avg_rtt_ms_; 70 int64_t avg_rtt_ms_;
69 71
70 // All Rtt reports within valid time interval, oldest first. 72 // All Rtt reports within valid time interval, oldest first.
71 std::list<RttTime> reports_; 73 std::list<RttTime> reports_;
72 74
73 // Observers getting stats reports. 75 // Observers getting stats reports.
74 std::list<CallStatsObserver*> observers_; 76 std::list<CallStatsObserver*> observers_;
75 77
76 RTC_DISALLOW_COPY_AND_ASSIGN(CallStats); 78 RTC_DISALLOW_COPY_AND_ASSIGN(CallStats);
77 }; 79 };
78 80
79 } // namespace webrtc 81 } // namespace webrtc
80 82
81 #endif // WEBRTC_VIDEO_ENGINE_CALL_STATS_H_ 83 #endif // WEBRTC_VIDEO_ENGINE_CALL_STATS_H_
OLDNEW
« no previous file with comments | « webrtc/test/fake_network_pipe_unittest.cc ('k') | webrtc/video_engine/call_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698