Add callbacks for receive channel RTCP statistics.

This allows a listener to receive new statistics as it is generated - avoiding the need to poll. This also makes handling stats from multiple RTP streams more tractable.
The change is primarily targeted at the new video engine API.

TEST=Unit test in ReceiveStatisticsTest. Integration tests to follow as call tests when fully wired up.

BUG=2235
R=henrika@webrtc.org, pbos@webrtc.org, stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/5089004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5323 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
sprang@webrtc.org
2013-12-19 13:26:02 +00:00
parent e682aa5077
commit 54ae4ffb9e
12 changed files with 260 additions and 60 deletions

View File

@@ -23,24 +23,9 @@ class Clock;
class StreamStatistician {
public:
struct Statistics {
Statistics()
: fraction_lost(0),
cumulative_lost(0),
extended_max_sequence_number(0),
jitter(0),
max_jitter(0) {}
uint8_t fraction_lost;
uint32_t cumulative_lost;
uint32_t extended_max_sequence_number;
uint32_t jitter;
uint32_t max_jitter;
};
virtual ~StreamStatistician();
virtual bool GetStatistics(Statistics* statistics, bool reset) = 0;
virtual bool GetStatistics(RtcpStatistics* statistics, bool reset) = 0;
virtual void GetDataCounters(uint32_t* bytes_received,
uint32_t* packets_received) const = 0;
virtual uint32_t BitrateReceived() const = 0;
@@ -78,6 +63,10 @@ class ReceiveStatistics : public Module {
// Sets the max reordering threshold in number of packets.
virtual void SetMaxReorderingThreshold(int max_reordering_threshold) = 0;
// Called on new RTCP stats creation.
virtual void RegisterRtcpStatisticsCallback(
RtcpStatisticsCallback* callback) = 0;
};
class NullReceiveStatistics : public ReceiveStatistics {
@@ -89,6 +78,8 @@ class NullReceiveStatistics : public ReceiveStatistics {
virtual int32_t TimeUntilNextProcess() OVERRIDE;
virtual int32_t Process() OVERRIDE;
virtual void SetMaxReorderingThreshold(int max_reordering_threshold) OVERRIDE;
virtual void RegisterRtcpStatisticsCallback(RtcpStatisticsCallback* callback)
OVERRIDE;
};
} // namespace webrtc