OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_RECEIVE_STATISTICS_H_ | |
12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_RECEIVE_STATISTICS_H_ | |
13 | |
14 #pragma message("WARNING: rtp_rtcp/interface is DEPRECATED; use include dir.") | |
15 | |
16 #include <map> | |
17 | |
18 #include "webrtc/modules/include/module.h" | |
19 #include "webrtc/modules/include/module_common_types.h" | |
20 #include "webrtc/typedefs.h" | |
21 | |
22 namespace webrtc { | |
23 | |
24 class Clock; | |
25 | |
26 class StreamStatistician { | |
27 public: | |
28 virtual ~StreamStatistician(); | |
29 | |
30 virtual bool GetStatistics(RtcpStatistics* statistics, bool reset) = 0; | |
31 virtual void GetDataCounters(size_t* bytes_received, | |
32 uint32_t* packets_received) const = 0; | |
33 | |
34 // Gets received stream data counters (includes reset counter values). | |
35 virtual void GetReceiveStreamDataCounters( | |
36 StreamDataCounters* data_counters) const = 0; | |
37 | |
38 virtual uint32_t BitrateReceived() const = 0; | |
39 | |
40 // Returns true if the packet with RTP header |header| is likely to be a | |
41 // retransmitted packet, false otherwise. | |
42 virtual bool IsRetransmitOfOldPacket(const RTPHeader& header, | |
43 int64_t min_rtt) const = 0; | |
44 | |
45 // Returns true if |sequence_number| is received in order, false otherwise. | |
46 virtual bool IsPacketInOrder(uint16_t sequence_number) const = 0; | |
47 }; | |
48 | |
49 typedef std::map<uint32_t, StreamStatistician*> StatisticianMap; | |
50 | |
51 class ReceiveStatistics : public Module { | |
52 public: | |
53 virtual ~ReceiveStatistics() {} | |
54 | |
55 static ReceiveStatistics* Create(Clock* clock); | |
56 | |
57 // Updates the receive statistics with this packet. | |
58 virtual void IncomingPacket(const RTPHeader& rtp_header, | |
59 size_t packet_length, | |
60 bool retransmitted) = 0; | |
61 | |
62 // Increment counter for number of FEC packets received. | |
63 virtual void FecPacketReceived(const RTPHeader& header, | |
64 size_t packet_length) = 0; | |
65 | |
66 // Returns a map of all statisticians which have seen an incoming packet | |
67 // during the last two seconds. | |
68 virtual StatisticianMap GetActiveStatisticians() const = 0; | |
69 | |
70 // Returns a pointer to the statistician of an ssrc. | |
71 virtual StreamStatistician* GetStatistician(uint32_t ssrc) const = 0; | |
72 | |
73 // Sets the max reordering threshold in number of packets. | |
74 virtual void SetMaxReorderingThreshold(int max_reordering_threshold) = 0; | |
75 | |
76 // Called on new RTCP stats creation. | |
77 virtual void RegisterRtcpStatisticsCallback( | |
78 RtcpStatisticsCallback* callback) = 0; | |
79 | |
80 // Called on new RTP stats creation. | |
81 virtual void RegisterRtpStatisticsCallback( | |
82 StreamDataCountersCallback* callback) = 0; | |
83 }; | |
84 | |
85 class NullReceiveStatistics : public ReceiveStatistics { | |
86 public: | |
87 void IncomingPacket(const RTPHeader& rtp_header, | |
88 size_t packet_length, | |
89 bool retransmitted) override; | |
90 void FecPacketReceived(const RTPHeader& header, | |
91 size_t packet_length) override; | |
92 StatisticianMap GetActiveStatisticians() const override; | |
93 StreamStatistician* GetStatistician(uint32_t ssrc) const override; | |
94 int64_t TimeUntilNextProcess() override; | |
95 int32_t Process() override; | |
96 void SetMaxReorderingThreshold(int max_reordering_threshold) override; | |
97 void RegisterRtcpStatisticsCallback( | |
98 RtcpStatisticsCallback* callback) override; | |
99 void RegisterRtpStatisticsCallback( | |
100 StreamDataCountersCallback* callback) override; | |
101 }; | |
102 | |
103 } // namespace webrtc | |
104 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RECEIVE_STATISTICS_H_ | |
OLD | NEW |