Add callbacks for send channel rtcp statistics

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

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5220 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
sprang@webrtc.org
2013-12-05 09:48:44 +00:00
parent c4726d06fa
commit a6ad6e5b58
11 changed files with 192 additions and 28 deletions

View File

@ -54,7 +54,8 @@ RTCPReceiver::RTCPReceiver(const int32_t id, Clock* clock,
_receivedInfoMap(),
_packetTimeOutMS(0),
_lastReceivedRrMs(0),
_lastIncreasedSequenceNumberMs(0) {
_lastIncreasedSequenceNumberMs(0),
stats_callback_(NULL) {
memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo));
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__);
}
@ -1359,6 +1360,19 @@ int32_t RTCPReceiver::UpdateTMMBR() {
return 0;
}
void RTCPReceiver::RegisterRtcpStatisticsCallback(
RtcpStatisticsCallback* callback) {
CriticalSectionScoped cs(_criticalSectionFeedbacks);
if (callback != NULL)
assert(stats_callback_ == NULL);
stats_callback_ = callback;
}
RtcpStatisticsCallback* RTCPReceiver::GetRtcpStatisticsCallback() {
CriticalSectionScoped cs(_criticalSectionFeedbacks);
return stats_callback_;
}
// Holding no Critical section
void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
RTCPPacketInformation& rtcpPacketInformation) {
@ -1453,6 +1467,24 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
}
}
}
{
CriticalSectionScoped cs(_criticalSectionFeedbacks);
if (stats_callback_) {
for (ReportBlockList::const_iterator it =
rtcpPacketInformation.report_blocks.begin();
it != rtcpPacketInformation.report_blocks.end();
++it) {
RtcpStatistics stats;
stats.cumulative_lost = it->cumulativeLost;
stats.extended_max_sequence_number = it->extendedHighSeqNum;
stats.fraction_lost = it->fractionLost;
stats.jitter = it->jitter;
stats_callback_->StatisticsUpdated(stats, local_ssrc);
}
}
}
}
int32_t RTCPReceiver::CNAME(const uint32_t remoteSSRC,