Reformat rtcp_receiver

git cl format --full

BUG=webrtc:5565
NOTRY=true

Review-Url: https://codereview.webrtc.org/2259213002
Cr-Commit-Position: refs/heads/master@{#13832}
This commit is contained in:
danilchap 2016-08-19 07:29:46 -07:00 committed by Commit bot
parent 861da3c662
commit da161d795c
4 changed files with 541 additions and 570 deletions

View File

@ -195,29 +195,27 @@ bool RTCPReceiver::NTP(uint32_t* ReceivedNTPsecs,
uint32_t* ReceivedNTPfrac,
uint32_t* RTCPArrivalTimeSecs,
uint32_t* RTCPArrivalTimeFrac,
uint32_t* rtcp_timestamp) const
{
rtc::CritScope lock(&_criticalSectionRTCPReceiver);
if(ReceivedNTPsecs)
{
*ReceivedNTPsecs = _remoteSenderInfo.NTPseconds; // NTP from incoming SendReport
}
if(ReceivedNTPfrac)
{
*ReceivedNTPfrac = _remoteSenderInfo.NTPfraction;
}
if(RTCPArrivalTimeFrac)
{
*RTCPArrivalTimeFrac = _lastReceivedSRNTPfrac; // local NTP time when we received a RTCP packet with a send block
}
if(RTCPArrivalTimeSecs)
{
*RTCPArrivalTimeSecs = _lastReceivedSRNTPsecs;
}
if (rtcp_timestamp) {
*rtcp_timestamp = _remoteSenderInfo.RTPtimeStamp;
}
return true;
uint32_t* rtcp_timestamp) const {
rtc::CritScope lock(&_criticalSectionRTCPReceiver);
if (ReceivedNTPsecs) {
*ReceivedNTPsecs =
_remoteSenderInfo.NTPseconds; // NTP from incoming SendReport
}
if (ReceivedNTPfrac) {
*ReceivedNTPfrac = _remoteSenderInfo.NTPfraction;
}
if (RTCPArrivalTimeFrac) {
*RTCPArrivalTimeFrac = _lastReceivedSRNTPfrac; // local NTP time when we
// received a RTCP packet
// with a send block
}
if (RTCPArrivalTimeSecs) {
*RTCPArrivalTimeSecs = _lastReceivedSRNTPsecs;
}
if (rtcp_timestamp) {
*rtcp_timestamp = _remoteSenderInfo.RTPtimeStamp;
}
return true;
}
bool RTCPReceiver::LastReceivedXrReferenceTimeInfo(
@ -232,8 +230,8 @@ bool RTCPReceiver::LastReceivedXrReferenceTimeInfo(
info->lastRR = _remoteXRReceiveTimeInfo.lastRR;
// Get the delay since last received report (RFC 3611).
uint32_t receive_time = RTCPUtility::MidNtp(_lastReceivedXRNTPsecs,
_lastReceivedXRNTPfrac);
uint32_t receive_time =
RTCPUtility::MidNtp(_lastReceivedXRNTPsecs, _lastReceivedXRNTPfrac);
uint32_t ntp_sec = 0;
uint32_t ntp_frac = 0;
@ -271,189 +269,182 @@ int32_t RTCPReceiver::StatisticsReceived(
return 0;
}
int32_t
RTCPReceiver::IncomingRTCPPacket(RTCPPacketInformation& rtcpPacketInformation,
RTCPUtility::RTCPParserV2* rtcpParser)
{
rtc::CritScope lock(&_criticalSectionRTCPReceiver);
int32_t RTCPReceiver::IncomingRTCPPacket(
RTCPPacketInformation& rtcpPacketInformation,
RTCPUtility::RTCPParserV2* rtcpParser) {
rtc::CritScope lock(&_criticalSectionRTCPReceiver);
_lastReceived = _clock->TimeInMilliseconds();
_lastReceived = _clock->TimeInMilliseconds();
if (packet_type_counter_.first_packet_time_ms == -1) {
packet_type_counter_.first_packet_time_ms = _lastReceived;
if (packet_type_counter_.first_packet_time_ms == -1) {
packet_type_counter_.first_packet_time_ms = _lastReceived;
}
RTCPUtility::RTCPPacketTypes pktType = rtcpParser->Begin();
while (pktType != RTCPPacketTypes::kInvalid) {
// Each "case" is responsible for iterate the parser to the
// next top level packet.
switch (pktType) {
case RTCPPacketTypes::kSr:
case RTCPPacketTypes::kRr:
HandleSenderReceiverReport(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kSdes:
HandleSDES(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kXrHeader:
HandleXrHeader(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kXrReceiverReferenceTime:
HandleXrReceiveReferenceTime(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kXrDlrrReportBlock:
HandleXrDlrrReportBlock(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kXrVoipMetric:
HandleXRVOIPMetric(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kBye:
HandleBYE(*rtcpParser);
break;
case RTCPPacketTypes::kRtpfbNack:
HandleNACK(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kRtpfbTmmbr:
HandleTMMBR(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kRtpfbTmmbn:
HandleTMMBN(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kRtpfbSrReq:
HandleSR_REQ(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kPsfbPli:
HandlePLI(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kPsfbSli:
HandleSLI(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kPsfbRpsi:
HandleRPSI(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kExtendedIj:
HandleIJ(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kPsfbFir:
HandleFIR(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kPsfbApp:
HandlePsfbApp(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kApp:
// generic application messages
HandleAPP(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kAppItem:
// generic application messages
HandleAPPItem(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kTransportFeedback:
HandleTransportFeedback(rtcpParser, &rtcpPacketInformation);
break;
default:
rtcpParser->Iterate();
break;
}
pktType = rtcpParser->PacketType();
}
RTCPUtility::RTCPPacketTypes pktType = rtcpParser->Begin();
while (pktType != RTCPPacketTypes::kInvalid) {
// Each "case" is responsible for iterate the parser to the
// next top level packet.
switch (pktType)
{
case RTCPPacketTypes::kSr:
case RTCPPacketTypes::kRr:
HandleSenderReceiverReport(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kSdes:
HandleSDES(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kXrHeader:
HandleXrHeader(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kXrReceiverReferenceTime:
HandleXrReceiveReferenceTime(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kXrDlrrReportBlock:
HandleXrDlrrReportBlock(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kXrVoipMetric:
HandleXRVOIPMetric(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kBye:
HandleBYE(*rtcpParser);
break;
case RTCPPacketTypes::kRtpfbNack:
HandleNACK(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kRtpfbTmmbr:
HandleTMMBR(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kRtpfbTmmbn:
HandleTMMBN(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kRtpfbSrReq:
HandleSR_REQ(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kPsfbPli:
HandlePLI(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kPsfbSli:
HandleSLI(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kPsfbRpsi:
HandleRPSI(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kExtendedIj:
HandleIJ(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kPsfbFir:
HandleFIR(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kPsfbApp:
HandlePsfbApp(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kApp:
// generic application messages
HandleAPP(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kAppItem:
// generic application messages
HandleAPPItem(*rtcpParser, rtcpPacketInformation);
break;
case RTCPPacketTypes::kTransportFeedback:
HandleTransportFeedback(rtcpParser, &rtcpPacketInformation);
break;
default:
rtcpParser->Iterate();
break;
}
pktType = rtcpParser->PacketType();
}
if (packet_type_counter_observer_ != NULL) {
packet_type_counter_observer_->RtcpPacketTypesCounterUpdated(
main_ssrc_, packet_type_counter_);
}
if (packet_type_counter_observer_ != NULL) {
packet_type_counter_observer_->RtcpPacketTypesCounterUpdated(
main_ssrc_, packet_type_counter_);
}
num_skipped_packets_ += rtcpParser->NumSkippedBlocks();
num_skipped_packets_ += rtcpParser->NumSkippedBlocks();
int64_t now = _clock->TimeInMilliseconds();
if (now - last_skipped_packets_warning_ >= kMaxWarningLogIntervalMs &&
num_skipped_packets_ > 0) {
last_skipped_packets_warning_ = now;
LOG(LS_WARNING) << num_skipped_packets_
<< " RTCP blocks were skipped due to being malformed or of "
"unrecognized/unsupported type, during the past "
<< (kMaxWarningLogIntervalMs / 1000) << " second period.";
}
int64_t now = _clock->TimeInMilliseconds();
if (now - last_skipped_packets_warning_ >= kMaxWarningLogIntervalMs &&
num_skipped_packets_ > 0) {
last_skipped_packets_warning_ = now;
LOG(LS_WARNING)
<< num_skipped_packets_
<< " RTCP blocks were skipped due to being malformed or of "
"unrecognized/unsupported type, during the past "
<< (kMaxWarningLogIntervalMs / 1000) << " second period.";
}
return 0;
return 0;
}
void
RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPPacketInformation& rtcpPacketInformation)
{
RTCPUtility::RTCPPacketTypes rtcpPacketType = rtcpParser.PacketType();
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
void RTCPReceiver::HandleSenderReceiverReport(
RTCPUtility::RTCPParserV2& rtcpParser,
RTCPPacketInformation& rtcpPacketInformation) {
RTCPUtility::RTCPPacketTypes rtcpPacketType = rtcpParser.PacketType();
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
assert((rtcpPacketType == RTCPPacketTypes::kRr) ||
(rtcpPacketType == RTCPPacketTypes::kSr));
assert((rtcpPacketType == RTCPPacketTypes::kRr) ||
(rtcpPacketType == RTCPPacketTypes::kSr));
// SR.SenderSSRC
// The synchronization source identifier for the originator of this SR packet
// SR.SenderSSRC
// The synchronization source identifier for the originator of this SR packet
// rtcpPacket.RR.SenderSSRC
// The source of the packet sender, same as of SR? or is this a CE?
// rtcpPacket.RR.SenderSSRC
// The source of the packet sender, same as of SR? or is this a CE?
const uint32_t remoteSSRC = (rtcpPacketType == RTCPPacketTypes::kRr)
? rtcpPacket.RR.SenderSSRC
: rtcpPacket.SR.SenderSSRC;
const uint32_t remoteSSRC = (rtcpPacketType == RTCPPacketTypes::kRr)
? rtcpPacket.RR.SenderSSRC
: rtcpPacket.SR.SenderSSRC;
rtcpPacketInformation.remoteSSRC = remoteSSRC;
rtcpPacketInformation.remoteSSRC = remoteSSRC;
RTCPReceiveInformation* ptrReceiveInfo = CreateReceiveInformation(remoteSSRC);
if (!ptrReceiveInfo)
RTCPReceiveInformation* ptrReceiveInfo = CreateReceiveInformation(remoteSSRC);
if (!ptrReceiveInfo) {
rtcpParser.Iterate();
return;
}
if (rtcpPacketType == RTCPPacketTypes::kSr) {
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "SR",
"remote_ssrc", remoteSSRC, "ssrc", main_ssrc_);
if (_remoteSSRC ==
remoteSSRC) // have I received RTP packets from this party
{
rtcpParser.Iterate();
return;
// only signal that we have received a SR when we accept one
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSr;
rtcpPacketInformation.ntp_secs = rtcpPacket.SR.NTPMostSignificant;
rtcpPacketInformation.ntp_frac = rtcpPacket.SR.NTPLeastSignificant;
rtcpPacketInformation.rtp_timestamp = rtcpPacket.SR.RTPTimestamp;
// We will only store the send report from one source, but
// we will store all the receive block
// Save the NTP time of this report
_remoteSenderInfo.NTPseconds = rtcpPacket.SR.NTPMostSignificant;
_remoteSenderInfo.NTPfraction = rtcpPacket.SR.NTPLeastSignificant;
_remoteSenderInfo.RTPtimeStamp = rtcpPacket.SR.RTPTimestamp;
_remoteSenderInfo.sendPacketCount = rtcpPacket.SR.SenderPacketCount;
_remoteSenderInfo.sendOctetCount = rtcpPacket.SR.SenderOctetCount;
_clock->CurrentNtp(_lastReceivedSRNTPsecs, _lastReceivedSRNTPfrac);
} else {
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRr;
}
} else {
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RR",
"remote_ssrc", remoteSSRC, "ssrc", main_ssrc_);
if (rtcpPacketType == RTCPPacketTypes::kSr) {
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "SR",
"remote_ssrc", remoteSSRC, "ssrc", main_ssrc_);
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRr;
}
// Update that this remote is alive.
ptrReceiveInfo->last_time_received_ms = _clock->TimeInMilliseconds();
if (_remoteSSRC == remoteSSRC) // have I received RTP packets from this party
{
// only signal that we have received a SR when we accept one
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSr;
rtcpPacketInformation.ntp_secs = rtcpPacket.SR.NTPMostSignificant;
rtcpPacketInformation.ntp_frac = rtcpPacket.SR.NTPLeastSignificant;
rtcpPacketInformation.rtp_timestamp = rtcpPacket.SR.RTPTimestamp;
// We will only store the send report from one source, but
// we will store all the receive block
// Save the NTP time of this report
_remoteSenderInfo.NTPseconds = rtcpPacket.SR.NTPMostSignificant;
_remoteSenderInfo.NTPfraction = rtcpPacket.SR.NTPLeastSignificant;
_remoteSenderInfo.RTPtimeStamp = rtcpPacket.SR.RTPTimestamp;
_remoteSenderInfo.sendPacketCount = rtcpPacket.SR.SenderPacketCount;
_remoteSenderInfo.sendOctetCount = rtcpPacket.SR.SenderOctetCount;
_clock->CurrentNtp(_lastReceivedSRNTPsecs, _lastReceivedSRNTPfrac);
}
else
{
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRr;
}
} else
{
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RR",
"remote_ssrc", remoteSSRC, "ssrc", main_ssrc_);
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRr;
}
// Update that this remote is alive.
ptrReceiveInfo->last_time_received_ms = _clock->TimeInMilliseconds();
rtcpPacketType = rtcpParser.Iterate();
while (rtcpPacketType == RTCPPacketTypes::kReportBlockItem) {
HandleReportBlock(rtcpPacket, rtcpPacketInformation, remoteSSRC);
rtcpPacketType = rtcpParser.Iterate();
while (rtcpPacketType == RTCPPacketTypes::kReportBlockItem) {
HandleReportBlock(rtcpPacket, rtcpPacketInformation, remoteSSRC);
rtcpPacketType = rtcpParser.Iterate();
}
}
}
void RTCPReceiver::HandleReportBlock(
@ -477,12 +468,11 @@ void RTCPReceiver::HandleReportBlock(
return;
}
RTCPReportBlockInformation* reportBlock =
CreateOrGetReportBlockInformation(remoteSSRC,
rtcpPacket.ReportBlockItem.SSRC);
RTCPReportBlockInformation* reportBlock = CreateOrGetReportBlockInformation(
remoteSSRC, rtcpPacket.ReportBlockItem.SSRC);
if (reportBlock == NULL) {
LOG(LS_WARNING) << "Failed to CreateReportBlockInformation("
<< remoteSSRC << ")";
LOG(LS_WARNING) << "Failed to CreateReportBlockInformation(" << remoteSSRC
<< ")";
return;
}
@ -584,8 +574,8 @@ RTCPReportBlockInformation* RTCPReceiver::GetReportBlockInformation(
return it_info->second;
}
RTCPCnameInformation*
RTCPReceiver::CreateCnameInformation(uint32_t remoteSSRC) {
RTCPCnameInformation* RTCPReceiver::CreateCnameInformation(
uint32_t remoteSSRC) {
rtc::CritScope lock(&_criticalSectionRTCPReceiver);
std::map<uint32_t, RTCPCnameInformation*>::iterator it =
@ -600,8 +590,8 @@ RTCPReceiver::CreateCnameInformation(uint32_t remoteSSRC) {
return cnameInfo;
}
RTCPCnameInformation*
RTCPReceiver::GetCnameInformation(uint32_t remoteSSRC) const {
RTCPCnameInformation* RTCPReceiver::GetCnameInformation(
uint32_t remoteSSRC) const {
rtc::CritScope lock(&_criticalSectionRTCPReceiver);
std::map<uint32_t, RTCPCnameInformation*>::const_iterator it =
@ -613,8 +603,8 @@ RTCPReceiver::GetCnameInformation(uint32_t remoteSSRC) const {
return it->second;
}
RTCPReceiveInformation*
RTCPReceiver::CreateReceiveInformation(uint32_t remoteSSRC) {
RTCPReceiveInformation* RTCPReceiver::CreateReceiveInformation(
uint32_t remoteSSRC) {
rtc::CritScope lock(&_criticalSectionRTCPReceiver);
std::map<uint32_t, RTCPReceiveInformation*>::iterator it =
@ -628,8 +618,8 @@ RTCPReceiver::CreateReceiveInformation(uint32_t remoteSSRC) {
return receiveInfo;
}
RTCPReceiveInformation*
RTCPReceiver::GetReceiveInformation(uint32_t remoteSSRC) {
RTCPReceiveInformation* RTCPReceiver::GetReceiveInformation(
uint32_t remoteSSRC) {
rtc::CritScope lock(&_criticalSectionRTCPReceiver);
std::map<uint32_t, RTCPReceiveInformation*>::iterator it =
@ -660,8 +650,8 @@ bool RTCPReceiver::RtcpRrSequenceNumberTimeout(int64_t rtcp_interval_ms) {
return false;
int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms;
if (_clock->TimeInMilliseconds() > _lastIncreasedSequenceNumberMs +
time_out_ms) {
if (_clock->TimeInMilliseconds() >
_lastIncreasedSequenceNumberMs + time_out_ms) {
// Reset the timer to only trigger one log.
_lastIncreasedSequenceNumberMs = 0;
return true;
@ -702,7 +692,7 @@ bool RTCPReceiver::UpdateRTCPReceiveInformationTimers() {
} else if (receiveInfo->ready_for_delete) {
// store our current receiveInfoItem
std::map<uint32_t, RTCPReceiveInformation*>::iterator
receiveInfoItemToBeErased = receiveInfoIt;
receiveInfoItemToBeErased = receiveInfoIt;
receiveInfoIt++;
delete receiveInfoItemToBeErased->second;
_receivedInfoMap.erase(receiveInfoItemToBeErased);
@ -779,20 +769,20 @@ void RTCPReceiver::HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser,
}
}
void
RTCPReceiver::HandleNACKItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation) {
void RTCPReceiver::HandleNACKItem(
const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation) {
rtcpPacketInformation.AddNACKPacket(rtcpPacket.NACKItem.PacketID);
nack_stats_.ReportRequest(rtcpPacket.NACKItem.PacketID);
uint16_t bitMask = rtcpPacket.NACKItem.BitMask;
if (bitMask) {
for (int i=1; i <= 16; ++i) {
for (int i = 1; i <= 16; ++i) {
if (bitMask & 0x01) {
rtcpPacketInformation.AddNACKPacket(rtcpPacket.NACKItem.PacketID + i);
nack_stats_.ReportRequest(rtcpPacket.NACKItem.PacketID + i);
}
bitMask = bitMask >>1;
bitMask = bitMask >> 1;
}
}
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpNack;
@ -805,8 +795,8 @@ void RTCPReceiver::HandleBYE(RTCPUtility::RTCPParserV2& rtcpParser) {
ReportBlockMap::iterator it = _receivedReportBlockMap.begin();
for (; it != _receivedReportBlockMap.end(); ++it) {
ReportBlockInfoMap* info_map = &(it->second);
ReportBlockInfoMap::iterator it_info = info_map->find(
rtcpPacket.BYE.SenderSSRC);
ReportBlockInfoMap::iterator it_info =
info_map->find(rtcpPacket.BYE.SenderSSRC);
if (it_info != info_map->end()) {
delete it_info->second;
info_map->erase(it_info);
@ -906,45 +896,47 @@ void RTCPReceiver::HandleXrDlrrReportBlockItem(
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpXrDlrrReportBlock;
}
void
RTCPReceiver::HandleXRVOIPMetric(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPPacketInformation& rtcpPacketInformation)
{
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
void RTCPReceiver::HandleXRVOIPMetric(
RTCPUtility::RTCPParserV2& rtcpParser,
RTCPPacketInformation& rtcpPacketInformation) {
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
if(rtcpPacket.XRVOIPMetricItem.SSRC == main_ssrc_)
{
// Store VoIP metrics block if it's about me
// from OriginatorSSRC do we filter it?
// rtcpPacket.XR.OriginatorSSRC;
if (rtcpPacket.XRVOIPMetricItem.SSRC == main_ssrc_) {
// Store VoIP metrics block if it's about me
// from OriginatorSSRC do we filter it?
// rtcpPacket.XR.OriginatorSSRC;
RTCPVoIPMetric receivedVoIPMetrics;
receivedVoIPMetrics.burstDensity = rtcpPacket.XRVOIPMetricItem.burstDensity;
receivedVoIPMetrics.burstDuration = rtcpPacket.XRVOIPMetricItem.burstDuration;
receivedVoIPMetrics.discardRate = rtcpPacket.XRVOIPMetricItem.discardRate;
receivedVoIPMetrics.endSystemDelay = rtcpPacket.XRVOIPMetricItem.endSystemDelay;
receivedVoIPMetrics.extRfactor = rtcpPacket.XRVOIPMetricItem.extRfactor;
receivedVoIPMetrics.gapDensity = rtcpPacket.XRVOIPMetricItem.gapDensity;
receivedVoIPMetrics.gapDuration = rtcpPacket.XRVOIPMetricItem.gapDuration;
receivedVoIPMetrics.Gmin = rtcpPacket.XRVOIPMetricItem.Gmin;
receivedVoIPMetrics.JBabsMax = rtcpPacket.XRVOIPMetricItem.JBabsMax;
receivedVoIPMetrics.JBmax = rtcpPacket.XRVOIPMetricItem.JBmax;
receivedVoIPMetrics.JBnominal = rtcpPacket.XRVOIPMetricItem.JBnominal;
receivedVoIPMetrics.lossRate = rtcpPacket.XRVOIPMetricItem.lossRate;
receivedVoIPMetrics.MOSCQ = rtcpPacket.XRVOIPMetricItem.MOSCQ;
receivedVoIPMetrics.MOSLQ = rtcpPacket.XRVOIPMetricItem.MOSLQ;
receivedVoIPMetrics.noiseLevel = rtcpPacket.XRVOIPMetricItem.noiseLevel;
receivedVoIPMetrics.RERL = rtcpPacket.XRVOIPMetricItem.RERL;
receivedVoIPMetrics.Rfactor = rtcpPacket.XRVOIPMetricItem.Rfactor;
receivedVoIPMetrics.roundTripDelay = rtcpPacket.XRVOIPMetricItem.roundTripDelay;
receivedVoIPMetrics.RXconfig = rtcpPacket.XRVOIPMetricItem.RXconfig;
receivedVoIPMetrics.signalLevel = rtcpPacket.XRVOIPMetricItem.signalLevel;
RTCPVoIPMetric receivedVoIPMetrics;
receivedVoIPMetrics.burstDensity = rtcpPacket.XRVOIPMetricItem.burstDensity;
receivedVoIPMetrics.burstDuration =
rtcpPacket.XRVOIPMetricItem.burstDuration;
receivedVoIPMetrics.discardRate = rtcpPacket.XRVOIPMetricItem.discardRate;
receivedVoIPMetrics.endSystemDelay =
rtcpPacket.XRVOIPMetricItem.endSystemDelay;
receivedVoIPMetrics.extRfactor = rtcpPacket.XRVOIPMetricItem.extRfactor;
receivedVoIPMetrics.gapDensity = rtcpPacket.XRVOIPMetricItem.gapDensity;
receivedVoIPMetrics.gapDuration = rtcpPacket.XRVOIPMetricItem.gapDuration;
receivedVoIPMetrics.Gmin = rtcpPacket.XRVOIPMetricItem.Gmin;
receivedVoIPMetrics.JBabsMax = rtcpPacket.XRVOIPMetricItem.JBabsMax;
receivedVoIPMetrics.JBmax = rtcpPacket.XRVOIPMetricItem.JBmax;
receivedVoIPMetrics.JBnominal = rtcpPacket.XRVOIPMetricItem.JBnominal;
receivedVoIPMetrics.lossRate = rtcpPacket.XRVOIPMetricItem.lossRate;
receivedVoIPMetrics.MOSCQ = rtcpPacket.XRVOIPMetricItem.MOSCQ;
receivedVoIPMetrics.MOSLQ = rtcpPacket.XRVOIPMetricItem.MOSLQ;
receivedVoIPMetrics.noiseLevel = rtcpPacket.XRVOIPMetricItem.noiseLevel;
receivedVoIPMetrics.RERL = rtcpPacket.XRVOIPMetricItem.RERL;
receivedVoIPMetrics.Rfactor = rtcpPacket.XRVOIPMetricItem.Rfactor;
receivedVoIPMetrics.roundTripDelay =
rtcpPacket.XRVOIPMetricItem.roundTripDelay;
receivedVoIPMetrics.RXconfig = rtcpPacket.XRVOIPMetricItem.RXconfig;
receivedVoIPMetrics.signalLevel = rtcpPacket.XRVOIPMetricItem.signalLevel;
rtcpPacketInformation.AddVoIPMetric(&receivedVoIPMetrics);
rtcpPacketInformation.AddVoIPMetric(&receivedVoIPMetrics);
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpXrVoipMetric; // received signal
}
rtcpParser.Iterate();
rtcpPacketInformation.rtcpPacketTypeFlags |=
kRtcpXrVoipMetric; // received signal
}
rtcpParser.Iterate();
}
void RTCPReceiver::HandlePLI(RTCPUtility::RTCPParserV2& rtcpParser,
@ -990,7 +982,8 @@ void RTCPReceiver::HandleTMMBR(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
while (pktType == RTCPPacketTypes::kRtpfbTmmbrItem) {
HandleTMMBRItem(*ptrReceiveInfo, rtcpPacket, rtcpPacketInformation, senderSSRC);
HandleTMMBRItem(*ptrReceiveInfo, rtcpPacket, rtcpPacketInformation,
senderSSRC);
pktType = rtcpParser.Iterate();
}
}
@ -1014,8 +1007,8 @@ void RTCPReceiver::HandleTMMBRItem(RTCPReceiveInformation& receiveInfo,
void RTCPReceiver::HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPPacketInformation& rtcpPacketInformation) {
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(
rtcpPacket.TMMBN.SenderSSRC);
RTCPReceiveInformation* ptrReceiveInfo =
GetReceiveInformation(rtcpPacket.TMMBN.SenderSSRC);
if (ptrReceiveInfo == NULL) {
// This remote SSRC must be saved before.
rtcpParser.Iterate();
@ -1067,37 +1060,37 @@ void RTCPReceiver::HandleSLI(RTCPUtility::RTCPParserV2& rtcpParser,
void RTCPReceiver::HandleSLIItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation) {
// in theory there could be multiple slices lost
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSli; // received signal that we need to refresh a slice
rtcpPacketInformation.rtcpPacketTypeFlags |=
kRtcpSli; // received signal that we need to refresh a slice
rtcpPacketInformation.sliPictureId = rtcpPacket.SLIItem.PictureId;
}
void
RTCPReceiver::HandleRPSI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
{
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
if (pktType == RTCPPacketTypes::kPsfbRpsiItem) {
if(rtcpPacket.RPSI.NumberOfValidBits%8 != 0)
{
// to us unknown
// continue
rtcpParser.Iterate();
return;
}
// Received signal that we have a confirmed reference picture.
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRpsi;
rtcpPacketInformation.rpsiPictureId = 0;
// convert NativeBitString to rpsiPictureId
uint8_t numberOfBytes = rtcpPacket.RPSI.NumberOfValidBits /8;
for(uint8_t n = 0; n < (numberOfBytes-1); n++)
{
rtcpPacketInformation.rpsiPictureId += (rtcpPacket.RPSI.NativeBitString[n] & 0x7f);
rtcpPacketInformation.rpsiPictureId <<= 7; // prepare next
}
rtcpPacketInformation.rpsiPictureId += (rtcpPacket.RPSI.NativeBitString[numberOfBytes-1] & 0x7f);
void RTCPReceiver::HandleRPSI(
RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) {
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
if (pktType == RTCPPacketTypes::kPsfbRpsiItem) {
if (rtcpPacket.RPSI.NumberOfValidBits % 8 != 0) {
// to us unknown
// continue
rtcpParser.Iterate();
return;
}
// Received signal that we have a confirmed reference picture.
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRpsi;
rtcpPacketInformation.rpsiPictureId = 0;
// convert NativeBitString to rpsiPictureId
uint8_t numberOfBytes = rtcpPacket.RPSI.NumberOfValidBits / 8;
for (uint8_t n = 0; n < (numberOfBytes - 1); n++) {
rtcpPacketInformation.rpsiPictureId +=
(rtcpPacket.RPSI.NativeBitString[n] & 0x7f);
rtcpPacketInformation.rpsiPictureId <<= 7; // prepare next
}
rtcpPacketInformation.rpsiPictureId +=
(rtcpPacket.RPSI.NativeBitString[numberOfBytes - 1] & 0x7f);
}
}
void RTCPReceiver::HandlePsfbApp(RTCPUtility::RTCPParserV2& rtcpParser,
@ -1127,7 +1120,7 @@ void RTCPReceiver::HandleIJItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation) {
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTransmissionTimeOffset;
rtcpPacketInformation.interArrivalJitter =
rtcpPacket.ExtendedJitterReportItem.Jitter;
rtcpPacket.ExtendedJitterReportItem.Jitter;
}
void RTCPReceiver::HandleREMBItem(
@ -1199,7 +1192,8 @@ void RTCPReceiver::HandleAPPItem(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPPacketInformation& rtcpPacketInformation) {
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
rtcpPacketInformation.AddApplicationData(rtcpPacket.APP.Data, rtcpPacket.APP.Size);
rtcpPacketInformation.AddApplicationData(rtcpPacket.APP.Data,
rtcpPacket.APP.Size);
rtcpParser.Iterate();
}
@ -1276,7 +1270,7 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpNack)) {
if (rtcpPacketInformation.nackSequenceNumbers.size() > 0) {
LOG(LS_VERBOSE) << "Incoming NACK length: "
<< rtcpPacketInformation.nackSequenceNumbers.size();
<< rtcpPacketInformation.nackSequenceNumbers.size();
_rtpRtcp.OnReceivedNACK(rtcpPacketInformation.nackSequenceNumbers);
}
}
@ -1319,8 +1313,7 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRr)) {
int64_t now = _clock->TimeInMilliseconds();
_cbRtcpBandwidthObserver->OnReceivedRtcpReceiverReport(
rtcpPacketInformation.report_blocks,
rtcpPacketInformation.rtt,
rtcpPacketInformation.report_blocks, rtcpPacketInformation.rtt,
now);
}
}
@ -1345,9 +1338,8 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
rtc::CritScope cs(&_criticalSectionFeedbacks);
if (stats_callback_) {
for (ReportBlockList::const_iterator it =
rtcpPacketInformation.report_blocks.begin();
it != rtcpPacketInformation.report_blocks.end();
++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;

View File

@ -26,224 +26,220 @@
namespace webrtc {
class ModuleRtpRtcpImpl;
class RTCPReceiver
{
public:
RTCPReceiver(Clock* clock,
bool receiver_only,
RtcpPacketTypeCounterObserver* packet_type_counter_observer,
RtcpBandwidthObserver* rtcp_bandwidth_observer,
RtcpIntraFrameObserver* rtcp_intra_frame_observer,
TransportFeedbackObserver* transport_feedback_observer,
ModuleRtpRtcpImpl* owner);
virtual ~RTCPReceiver();
class RTCPReceiver {
public:
RTCPReceiver(Clock* clock,
bool receiver_only,
RtcpPacketTypeCounterObserver* packet_type_counter_observer,
RtcpBandwidthObserver* rtcp_bandwidth_observer,
RtcpIntraFrameObserver* rtcp_intra_frame_observer,
TransportFeedbackObserver* transport_feedback_observer,
ModuleRtpRtcpImpl* owner);
virtual ~RTCPReceiver();
int64_t LastReceived();
int64_t LastReceivedReceiverReport() const;
int64_t LastReceived();
int64_t LastReceivedReceiverReport() const;
void SetSsrcs(uint32_t main_ssrc,
const std::set<uint32_t>& registered_ssrcs);
void SetRemoteSSRC(uint32_t ssrc);
uint32_t RemoteSSRC() const;
void SetSsrcs(uint32_t main_ssrc, const std::set<uint32_t>& registered_ssrcs);
void SetRemoteSSRC(uint32_t ssrc);
uint32_t RemoteSSRC() const;
int32_t IncomingRTCPPacket(
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
RTCPUtility::RTCPParserV2 *rtcpParser);
int32_t IncomingRTCPPacket(
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
RTCPUtility::RTCPParserV2* rtcpParser);
void TriggerCallbacksFromRTCPPacket(
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
void TriggerCallbacksFromRTCPPacket(
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
// get received cname
int32_t CNAME(uint32_t remoteSSRC, char cName[RTCP_CNAME_SIZE]) const;
// get received cname
int32_t CNAME(uint32_t remoteSSRC, char cName[RTCP_CNAME_SIZE]) const;
// get received NTP
bool NTP(uint32_t* ReceivedNTPsecs,
uint32_t* ReceivedNTPfrac,
uint32_t* RTCPArrivalTimeSecs,
uint32_t* RTCPArrivalTimeFrac,
uint32_t* rtcp_timestamp) const;
// get received NTP
bool NTP(uint32_t* ReceivedNTPsecs,
uint32_t* ReceivedNTPfrac,
uint32_t* RTCPArrivalTimeSecs,
uint32_t* RTCPArrivalTimeFrac,
uint32_t* rtcp_timestamp) const;
bool LastReceivedXrReferenceTimeInfo(RtcpReceiveTimeInfo* info) const;
bool LastReceivedXrReferenceTimeInfo(RtcpReceiveTimeInfo* info) const;
// get rtt
int32_t RTT(uint32_t remoteSSRC,
int64_t* RTT,
int64_t* avgRTT,
int64_t* minRTT,
int64_t* maxRTT) const;
// get rtt
int32_t RTT(uint32_t remoteSSRC,
int64_t* RTT,
int64_t* avgRTT,
int64_t* minRTT,
int64_t* maxRTT) const;
int32_t SenderInfoReceived(RTCPSenderInfo* senderInfo) const;
int32_t SenderInfoReceived(RTCPSenderInfo* senderInfo) const;
void SetRtcpXrRrtrStatus(bool enable);
bool GetAndResetXrRrRtt(int64_t* rtt_ms);
void SetRtcpXrRrtrStatus(bool enable);
bool GetAndResetXrRrRtt(int64_t* rtt_ms);
// get statistics
int32_t StatisticsReceived(
std::vector<RTCPReportBlock>* receiveBlocks) const;
// get statistics
int32_t StatisticsReceived(std::vector<RTCPReportBlock>* receiveBlocks) const;
// Returns true if we haven't received an RTCP RR for several RTCP
// intervals, but only triggers true once.
bool RtcpRrTimeout(int64_t rtcp_interval_ms);
// Returns true if we haven't received an RTCP RR for several RTCP
// intervals, but only triggers true once.
bool RtcpRrTimeout(int64_t rtcp_interval_ms);
// Returns true if we haven't received an RTCP RR telling the receive side
// has not received RTP packets for too long, i.e. extended highest sequence
// number hasn't increased for several RTCP intervals. The function only
// returns true once until a new RR is received.
bool RtcpRrSequenceNumberTimeout(int64_t rtcp_interval_ms);
// Returns true if we haven't received an RTCP RR telling the receive side
// has not received RTP packets for too long, i.e. extended highest sequence
// number hasn't increased for several RTCP intervals. The function only
// returns true once until a new RR is received.
bool RtcpRrSequenceNumberTimeout(int64_t rtcp_interval_ms);
// Get TMMBR
std::vector<rtcp::TmmbItem> TMMBRReceived() const;
// Get TMMBR
std::vector<rtcp::TmmbItem> TMMBRReceived() const;
bool UpdateRTCPReceiveInformationTimers();
bool UpdateRTCPReceiveInformationTimers();
std::vector<rtcp::TmmbItem> BoundingSet(bool* tmmbr_owner);
std::vector<rtcp::TmmbItem> BoundingSet(bool* tmmbr_owner);
int32_t UpdateTMMBR();
int32_t UpdateTMMBR();
void RegisterRtcpStatisticsCallback(RtcpStatisticsCallback* callback);
RtcpStatisticsCallback* GetRtcpStatisticsCallback();
void RegisterRtcpStatisticsCallback(RtcpStatisticsCallback* callback);
RtcpStatisticsCallback* GetRtcpStatisticsCallback();
protected:
RTCPUtility::RTCPCnameInformation* CreateCnameInformation(uint32_t remoteSSRC);
RTCPUtility::RTCPCnameInformation* GetCnameInformation(
uint32_t remoteSSRC) const;
protected:
RTCPUtility::RTCPCnameInformation* CreateCnameInformation(
uint32_t remoteSSRC);
RTCPUtility::RTCPCnameInformation* GetCnameInformation(
uint32_t remoteSSRC) const;
RTCPHelp::RTCPReceiveInformation* CreateReceiveInformation(
uint32_t remoteSSRC);
RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(uint32_t remoteSSRC);
RTCPHelp::RTCPReceiveInformation* CreateReceiveInformation(
uint32_t remoteSSRC);
RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(uint32_t remoteSSRC);
void HandleSenderReceiverReport(
RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleSenderReceiverReport(
RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleReportBlock(
const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
uint32_t remoteSSRC)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleSDESChunk(RTCPUtility::RTCPParserV2& rtcpParser)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleXrHeader(RTCPUtility::RTCPParserV2& parser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleXrReceiveReferenceTime(
RTCPUtility::RTCPParserV2& parser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleXrDlrrReportBlock(
RTCPUtility::RTCPParserV2& parser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleXrDlrrReportBlockItem(
const RTCPUtility::RTCPPacket& packet,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleXRVOIPMetric(
RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleNACKItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleBYE(RTCPUtility::RTCPParserV2& rtcpParser)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandlePLI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleSLI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleSLIItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleRPSI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandlePsfbApp(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleREMBItem(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleIJ(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleIJItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleTMMBR(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleTMMBRItem(RTCPHelp::RTCPReceiveInformation& receiveInfo,
const RTCPUtility::RTCPPacket& rtcpPacket,
void HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
uint32_t senderSSRC)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
uint32_t remoteSSRC)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleSR_REQ(RTCPUtility::RTCPParserV2& rtcpParser,
void HandleSDESChunk(RTCPUtility::RTCPParserV2& rtcpParser)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleXrHeader(RTCPUtility::RTCPParserV2& parser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleTMMBNItem(RTCPHelp::RTCPReceiveInformation& receiveInfo,
const RTCPUtility::RTCPPacket& rtcpPacket)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleXrReceiveReferenceTime(
RTCPUtility::RTCPParserV2& parser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleFIR(RTCPUtility::RTCPParserV2& rtcpParser,
void HandleXrDlrrReportBlock(
RTCPUtility::RTCPParserV2& parser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleXrDlrrReportBlockItem(
const RTCPUtility::RTCPPacket& packet,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleXRVOIPMetric(
RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleNACKItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleBYE(RTCPUtility::RTCPParserV2& rtcpParser)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandlePLI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleSLI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleSLIItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleRPSI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandlePsfbApp(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleREMBItem(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleIJ(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleIJItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleTMMBR(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleFIRItem(RTCPHelp::RTCPReceiveInformation* receiveInfo,
void HandleTMMBRItem(RTCPHelp::RTCPReceiveInformation& receiveInfo,
const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
uint32_t senderSSRC)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleAPP(RTCPUtility::RTCPParserV2& rtcpParser,
void HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleAPPItem(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleSR_REQ(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleTransportFeedback(
RTCPUtility::RTCPParserV2* rtcp_parser,
RTCPHelp::RTCPPacketInformation* rtcp_packet_information)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleTMMBNItem(RTCPHelp::RTCPReceiveInformation& receiveInfo,
const RTCPUtility::RTCPPacket& rtcpPacket)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleFIR(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleFIRItem(RTCPHelp::RTCPReceiveInformation* receiveInfo,
const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleAPP(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleAPPItem(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
void HandleTransportFeedback(
RTCPUtility::RTCPParserV2* rtcp_parser,
RTCPHelp::RTCPPacketInformation* rtcp_packet_information)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
private:
typedef std::map<uint32_t, RTCPHelp::RTCPReceiveInformation*>
ReceivedInfoMap;
typedef std::map<uint32_t, RTCPHelp::RTCPReceiveInformation*> ReceivedInfoMap;
// RTCP report block information mapped by remote SSRC.
typedef std::map<uint32_t, RTCPHelp::RTCPReportBlockInformation*>
ReportBlockInfoMap;
@ -251,11 +247,13 @@ protected:
typedef std::map<uint32_t, ReportBlockInfoMap> ReportBlockMap;
RTCPHelp::RTCPReportBlockInformation* CreateOrGetReportBlockInformation(
uint32_t remote_ssrc, uint32_t source_ssrc)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
uint32_t remote_ssrc,
uint32_t source_ssrc)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
RTCPHelp::RTCPReportBlockInformation* GetReportBlockInformation(
uint32_t remote_ssrc, uint32_t source_ssrc) const
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
uint32_t remote_ssrc,
uint32_t source_ssrc) const
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
Clock* const _clock;
const bool receiver_only_;
@ -311,4 +309,4 @@ protected:
int64_t last_skipped_packets_warning_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_

View File

@ -39,81 +39,67 @@ RTCPPacketInformation::RTCPPacketInformation()
xr_dlrr_item(false),
VoIPMetric(nullptr) {}
RTCPPacketInformation::~RTCPPacketInformation()
{
delete [] applicationData;
RTCPPacketInformation::~RTCPPacketInformation() {
delete[] applicationData;
}
void
RTCPPacketInformation::AddVoIPMetric(const RTCPVoIPMetric* metric)
{
VoIPMetric.reset(new RTCPVoIPMetric());
memcpy(VoIPMetric.get(), metric, sizeof(RTCPVoIPMetric));
void RTCPPacketInformation::AddVoIPMetric(const RTCPVoIPMetric* metric) {
VoIPMetric.reset(new RTCPVoIPMetric());
memcpy(VoIPMetric.get(), metric, sizeof(RTCPVoIPMetric));
}
void RTCPPacketInformation::AddApplicationData(const uint8_t* data,
const uint16_t size) {
uint8_t* oldData = applicationData;
uint16_t oldLength = applicationLength;
uint8_t* oldData = applicationData;
uint16_t oldLength = applicationLength;
// Don't copy more than kRtcpAppCode_DATA_SIZE bytes.
uint16_t copySize = size;
if (size > kRtcpAppCode_DATA_SIZE) {
copySize = kRtcpAppCode_DATA_SIZE;
}
// Don't copy more than kRtcpAppCode_DATA_SIZE bytes.
uint16_t copySize = size;
if (size > kRtcpAppCode_DATA_SIZE) {
copySize = kRtcpAppCode_DATA_SIZE;
}
applicationLength += copySize;
applicationData = new uint8_t[applicationLength];
applicationLength += copySize;
applicationData = new uint8_t[applicationLength];
if (oldData)
{
memcpy(applicationData, oldData, oldLength);
memcpy(applicationData+oldLength, data, copySize);
delete [] oldData;
} else
{
memcpy(applicationData, data, copySize);
}
if (oldData) {
memcpy(applicationData, oldData, oldLength);
memcpy(applicationData + oldLength, data, copySize);
delete[] oldData;
} else {
memcpy(applicationData, data, copySize);
}
}
void
RTCPPacketInformation::ResetNACKPacketIdArray()
{
void RTCPPacketInformation::ResetNACKPacketIdArray() {
nackSequenceNumbers.clear();
}
void
RTCPPacketInformation::AddNACKPacket(const uint16_t packetID)
{
void RTCPPacketInformation::AddNACKPacket(const uint16_t packetID) {
if (nackSequenceNumbers.size() >= kSendSideNackListSizeSanity) {
return;
}
nackSequenceNumbers.push_back(packetID);
}
void
RTCPPacketInformation::AddReportInfo(
const RTCPReportBlockInformation& report_block_info)
{
void RTCPPacketInformation::AddReportInfo(
const RTCPReportBlockInformation& report_block_info) {
this->rtt = report_block_info.RTT;
report_blocks.push_back(report_block_info.remoteReceiveBlock);
}
RTCPReportBlockInformation::RTCPReportBlockInformation():
remoteReceiveBlock(),
remoteMaxJitter(0),
RTT(0),
minRTT(0),
maxRTT(0),
avgRTT(0),
numAverageCalcs(0)
{
memset(&remoteReceiveBlock,0,sizeof(remoteReceiveBlock));
RTCPReportBlockInformation::RTCPReportBlockInformation()
: remoteReceiveBlock(),
remoteMaxJitter(0),
RTT(0),
minRTT(0),
maxRTT(0),
avgRTT(0),
numAverageCalcs(0) {
memset(&remoteReceiveBlock, 0, sizeof(remoteReceiveBlock));
}
RTCPReportBlockInformation::~RTCPReportBlockInformation()
{
}
RTCPReportBlockInformation::~RTCPReportBlockInformation() {}
RTCPReceiveInformation::RTCPReceiveInformation() = default;
RTCPReceiveInformation::~RTCPReceiveInformation() = default;
@ -122,8 +108,7 @@ void RTCPReceiveInformation::InsertTmmbrItem(uint32_t sender_ssrc,
const rtcp::TmmbItem& tmmbr_item,
int64_t current_time_ms) {
TimedTmmbrItem* entry = &tmmbr_[sender_ssrc];
entry->tmmbr_item = rtcp::TmmbItem(sender_ssrc,
tmmbr_item.bitrate_bps(),
entry->tmmbr_item = rtcp::TmmbItem(sender_ssrc, tmmbr_item.bitrate_bps(),
tmmbr_item.packet_overhead());
entry->last_updated_ms = current_time_ms;
}

View File

@ -25,74 +25,70 @@ namespace webrtc {
namespace rtcp {
class TransportFeedback;
}
namespace RTCPHelp
{
namespace RTCPHelp {
class RTCPReportBlockInformation
{
public:
RTCPReportBlockInformation();
~RTCPReportBlockInformation();
class RTCPReportBlockInformation {
public:
RTCPReportBlockInformation();
~RTCPReportBlockInformation();
// Statistics
RTCPReportBlock remoteReceiveBlock;
uint32_t remoteMaxJitter;
// Statistics
RTCPReportBlock remoteReceiveBlock;
uint32_t remoteMaxJitter;
// RTT
int64_t RTT;
int64_t minRTT;
int64_t maxRTT;
int64_t avgRTT;
uint32_t numAverageCalcs;
// RTT
int64_t RTT;
int64_t minRTT;
int64_t maxRTT;
int64_t avgRTT;
uint32_t numAverageCalcs;
};
class RTCPPacketInformation
{
public:
RTCPPacketInformation();
~RTCPPacketInformation();
class RTCPPacketInformation {
public:
RTCPPacketInformation();
~RTCPPacketInformation();
void AddVoIPMetric(const RTCPVoIPMetric* metric);
void AddVoIPMetric(const RTCPVoIPMetric* metric);
void AddApplicationData(const uint8_t* data,
const uint16_t size);
void AddApplicationData(const uint8_t* data, const uint16_t size);
void AddNACKPacket(const uint16_t packetID);
void ResetNACKPacketIdArray();
void AddNACKPacket(const uint16_t packetID);
void ResetNACKPacketIdArray();
void AddReportInfo(const RTCPReportBlockInformation& report_block_info);
void AddReportInfo(const RTCPReportBlockInformation& report_block_info);
uint32_t rtcpPacketTypeFlags; // RTCPPacketTypeFlags bit field
uint32_t remoteSSRC;
uint32_t rtcpPacketTypeFlags; // RTCPPacketTypeFlags bit field
uint32_t remoteSSRC;
std::list<uint16_t> nackSequenceNumbers;
std::list<uint16_t> nackSequenceNumbers;
uint8_t applicationSubType;
uint32_t applicationName;
uint8_t* applicationData;
uint16_t applicationLength;
uint8_t applicationSubType;
uint32_t applicationName;
uint8_t* applicationData;
uint16_t applicationLength;
ReportBlockList report_blocks;
int64_t rtt;
ReportBlockList report_blocks;
int64_t rtt;
uint32_t interArrivalJitter;
uint32_t interArrivalJitter;
uint8_t sliPictureId;
uint64_t rpsiPictureId;
uint32_t receiverEstimatedMaxBitrate;
uint8_t sliPictureId;
uint64_t rpsiPictureId;
uint32_t receiverEstimatedMaxBitrate;
uint32_t ntp_secs;
uint32_t ntp_frac;
uint32_t rtp_timestamp;
uint32_t ntp_secs;
uint32_t ntp_frac;
uint32_t rtp_timestamp;
uint32_t xr_originator_ssrc;
bool xr_dlrr_item;
std::unique_ptr<RTCPVoIPMetric> VoIPMetric;
uint32_t xr_originator_ssrc;
bool xr_dlrr_item;
std::unique_ptr<RTCPVoIPMetric> VoIPMetric;
std::unique_ptr<rtcp::TransportFeedback> transport_feedback_;
std::unique_ptr<rtcp::TransportFeedback> transport_feedback_;
private:
RTC_DISALLOW_COPY_AND_ASSIGN(RTCPPacketInformation);
private:
RTC_DISALLOW_COPY_AND_ASSIGN(RTCPPacketInformation);
};
class RTCPReceiveInformation {
@ -130,4 +126,4 @@ class RTCPReceiveInformation {
} // end namespace RTCPHelp
} // namespace webrtc
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_HELP_H_
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_HELP_H_