Add callbacks for receive channel RTP statistics

This allows a listener to receive new statistics (byte/packet counts, etc) 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=mflodman@webrtc.org, pbos@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5416 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
sprang@webrtc.org
2014-01-23 10:00:39 +00:00
parent 91db93d24f
commit 0e93257cee
9 changed files with 300 additions and 110 deletions

View File

@@ -51,9 +51,13 @@ class ReceiveStatistics : public Module {
static ReceiveStatistics* Create(Clock* clock);
// Updates the receive statistics with this packet.
virtual void IncomingPacket(const RTPHeader& rtp_header, size_t bytes,
virtual void IncomingPacket(const RTPHeader& rtp_header,
size_t bytes,
bool retransmitted) = 0;
// Increment counter for number of FEC packets received.
virtual void FecPacketReceived(uint32_t ssrc) = 0;
// Returns a map of all statisticians which have seen an incoming packet
// during the last two seconds.
virtual StatisticianMap GetActiveStatisticians() const = 0;
@@ -67,12 +71,18 @@ class ReceiveStatistics : public Module {
// Called on new RTCP stats creation.
virtual void RegisterRtcpStatisticsCallback(
RtcpStatisticsCallback* callback) = 0;
// Called on new RTP stats creation.
virtual void RegisterRtpStatisticsCallback(
StreamDataCountersCallback* callback) = 0;
};
class NullReceiveStatistics : public ReceiveStatistics {
public:
virtual void IncomingPacket(const RTPHeader& rtp_header, size_t bytes,
virtual void IncomingPacket(const RTPHeader& rtp_header,
size_t bytes,
bool retransmitted) OVERRIDE;
virtual void FecPacketReceived(uint32_t ssrc) OVERRIDE;
virtual StatisticianMap GetActiveStatisticians() const OVERRIDE;
virtual StreamStatistician* GetStatistician(uint32_t ssrc) const OVERRIDE;
virtual int32_t TimeUntilNextProcess() OVERRIDE;
@@ -80,6 +90,8 @@ class NullReceiveStatistics : public ReceiveStatistics {
virtual void SetMaxReorderingThreshold(int max_reordering_threshold) OVERRIDE;
virtual void RegisterRtcpStatisticsCallback(RtcpStatisticsCallback* callback)
OVERRIDE;
virtual void RegisterRtpStatisticsCallback(
StreamDataCountersCallback* callback) OVERRIDE;
};
} // namespace webrtc