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

Side by Side Diff: webrtc/modules/rtp_rtcp/include/receive_statistics.h

Issue 2988763002: Take smaller interface for RtpRtcp::Configuration::receive_statistics (Closed)
Patch Set: rerenaming Created 3 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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_MODULES_RTP_RTCP_INCLUDE_RECEIVE_STATISTICS_H_ 11 #ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_RECEIVE_STATISTICS_H_
12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_RECEIVE_STATISTICS_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_RECEIVE_STATISTICS_H_
13 13
14 #include <map> 14 #include <map>
15 #include <vector>
15 16
16 #include "webrtc/modules/include/module.h" 17 #include "webrtc/modules/include/module.h"
17 #include "webrtc/modules/include/module_common_types.h" 18 #include "webrtc/modules/include/module_common_types.h"
19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h"
18 #include "webrtc/typedefs.h" 20 #include "webrtc/typedefs.h"
19 21
20 namespace webrtc { 22 namespace webrtc {
21 23
22 class Clock; 24 class Clock;
23 25
26 class ReceiveStatisticsProvider {
27 public:
28 virtual ~ReceiveStatisticsProvider() = default;
29 // Collects receive statistic in a form of rtcp report blocks.
30 // Returns at most |max_blocks| report blocks.
31 virtual std::vector<rtcp::ReportBlock> RtcpReportBlocks(
32 size_t max_blocks) = 0;
33 };
34
24 class StreamStatistician { 35 class StreamStatistician {
25 public: 36 public:
26 virtual ~StreamStatistician(); 37 virtual ~StreamStatistician();
27 38
28 virtual bool GetStatistics(RtcpStatistics* statistics, bool reset) = 0; 39 virtual bool GetStatistics(RtcpStatistics* statistics, bool reset) = 0;
29 virtual void GetDataCounters(size_t* bytes_received, 40 virtual void GetDataCounters(size_t* bytes_received,
30 uint32_t* packets_received) const = 0; 41 uint32_t* packets_received) const = 0;
31 42
32 // Gets received stream data counters (includes reset counter values). 43 // Gets received stream data counters (includes reset counter values).
33 virtual void GetReceiveStreamDataCounters( 44 virtual void GetReceiveStreamDataCounters(
34 StreamDataCounters* data_counters) const = 0; 45 StreamDataCounters* data_counters) const = 0;
35 46
36 virtual uint32_t BitrateReceived() const = 0; 47 virtual uint32_t BitrateReceived() const = 0;
37 48
38 // Returns true if the packet with RTP header |header| is likely to be a 49 // Returns true if the packet with RTP header |header| is likely to be a
39 // retransmitted packet, false otherwise. 50 // retransmitted packet, false otherwise.
40 virtual bool IsRetransmitOfOldPacket(const RTPHeader& header, 51 virtual bool IsRetransmitOfOldPacket(const RTPHeader& header,
41 int64_t min_rtt) const = 0; 52 int64_t min_rtt) const = 0;
42 53
43 // Returns true if |sequence_number| is received in order, false otherwise. 54 // Returns true if |sequence_number| is received in order, false otherwise.
44 virtual bool IsPacketInOrder(uint16_t sequence_number) const = 0; 55 virtual bool IsPacketInOrder(uint16_t sequence_number) const = 0;
45 }; 56 };
46 57
47 typedef std::map<uint32_t, StreamStatistician*> StatisticianMap; 58 typedef std::map<uint32_t, StreamStatistician*> StatisticianMap;
48 59
49 class ReceiveStatistics { 60 class ReceiveStatistics : public ReceiveStatisticsProvider {
50 public: 61 public:
51 virtual ~ReceiveStatistics() {} 62 ~ReceiveStatistics() override = default;
52 63
53 static ReceiveStatistics* Create(Clock* clock); 64 static ReceiveStatistics* Create(Clock* clock);
54 65
55 // Updates the receive statistics with this packet. 66 // Updates the receive statistics with this packet.
56 virtual void IncomingPacket(const RTPHeader& rtp_header, 67 virtual void IncomingPacket(const RTPHeader& rtp_header,
57 size_t packet_length, 68 size_t packet_length,
58 bool retransmitted) = 0; 69 bool retransmitted) = 0;
59 70
60 // Increment counter for number of FEC packets received. 71 // Increment counter for number of FEC packets received.
61 virtual void FecPacketReceived(const RTPHeader& header, 72 virtual void FecPacketReceived(const RTPHeader& header,
62 size_t packet_length) = 0; 73 size_t packet_length) = 0;
63 74
64 // Returns a map of all statisticians which have seen an incoming packet 75 // Returns a map of all statisticians which have seen an incoming packet
65 // during the last two seconds. 76 // during the last two seconds.
66 virtual StatisticianMap GetActiveStatisticians() const = 0; 77 virtual StatisticianMap GetActiveStatisticians() const = 0;
67 78
68 // Returns a pointer to the statistician of an ssrc. 79 // Returns a pointer to the statistician of an ssrc.
69 virtual StreamStatistician* GetStatistician(uint32_t ssrc) const = 0; 80 virtual StreamStatistician* GetStatistician(uint32_t ssrc) const = 0;
70 81
71 // Sets the max reordering threshold in number of packets. 82 // Sets the max reordering threshold in number of packets.
72 virtual void SetMaxReorderingThreshold(int max_reordering_threshold) = 0; 83 virtual void SetMaxReorderingThreshold(int max_reordering_threshold) = 0;
73 84
74 // Called on new RTCP stats creation. 85 // Called on new RTCP stats creation.
75 virtual void RegisterRtcpStatisticsCallback( 86 virtual void RegisterRtcpStatisticsCallback(
76 RtcpStatisticsCallback* callback) = 0; 87 RtcpStatisticsCallback* callback) = 0;
77 88
78 // Called on new RTP stats creation. 89 // Called on new RTP stats creation.
79 virtual void RegisterRtpStatisticsCallback( 90 virtual void RegisterRtpStatisticsCallback(
80 StreamDataCountersCallback* callback) = 0; 91 StreamDataCountersCallback* callback) = 0;
92
93 // TODO(danilchap): Make pure virtual when all implmentations of the
94 // ReceiveStatistics interface will implement it.
95 std::vector<rtcp::ReportBlock> RtcpReportBlocks(size_t max_blocks) override;
81 }; 96 };
82 97
83 class NullReceiveStatistics : public ReceiveStatistics { 98 class NullReceiveStatistics : public ReceiveStatistics {
84 public: 99 public:
85 void IncomingPacket(const RTPHeader& rtp_header, 100 void IncomingPacket(const RTPHeader& rtp_header,
86 size_t packet_length, 101 size_t packet_length,
87 bool retransmitted) override; 102 bool retransmitted) override;
88 void FecPacketReceived(const RTPHeader& header, 103 void FecPacketReceived(const RTPHeader& header,
89 size_t packet_length) override; 104 size_t packet_length) override;
90 StatisticianMap GetActiveStatisticians() const override; 105 StatisticianMap GetActiveStatisticians() const override;
91 StreamStatistician* GetStatistician(uint32_t ssrc) const override; 106 StreamStatistician* GetStatistician(uint32_t ssrc) const override;
92 void SetMaxReorderingThreshold(int max_reordering_threshold) override; 107 void SetMaxReorderingThreshold(int max_reordering_threshold) override;
93 void RegisterRtcpStatisticsCallback( 108 void RegisterRtcpStatisticsCallback(
94 RtcpStatisticsCallback* callback) override; 109 RtcpStatisticsCallback* callback) override;
95 void RegisterRtpStatisticsCallback( 110 void RegisterRtpStatisticsCallback(
96 StreamDataCountersCallback* callback) override; 111 StreamDataCountersCallback* callback) override;
97 }; 112 };
98 113
99 } // namespace webrtc 114 } // namespace webrtc
100 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RECEIVE_STATISTICS_H_ 115 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RECEIVE_STATISTICS_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/include/rtp_rtcp.h » ('j') | webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698