From 17366bc09081fae148d1f95941eeedb584a2a2a2 Mon Sep 17 00:00:00 2001 From: danilchap Date: Tue, 13 Sep 2016 23:54:48 -0700 Subject: [PATCH] Remove handling unused rtcp packets. App, ExtendedJitterReport and VoipMetric in ExtenedReports are not used when received (no callbacks, no state change), so removed. BUG=webrtc:5260 Review-Url: https://codereview.webrtc.org/2320703003 Cr-Commit-Position: refs/heads/master@{#14204} --- .../modules/rtp_rtcp/source/rtcp_receiver.cc | 96 ------------------- .../modules/rtp_rtcp/source/rtcp_receiver.h | 21 ---- .../rtp_rtcp/source/rtcp_receiver_help.cc | 40 +------- .../rtp_rtcp/source/rtcp_receiver_help.h | 12 --- 4 files changed, 2 insertions(+), 167 deletions(-) diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc index 4d30bb0784..71cf86f3ec 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc @@ -314,9 +314,6 @@ int32_t RTCPReceiver::IncomingRTCPPacket( case RTCPPacketTypes::kXrDlrrReportBlock: HandleXrDlrrReportBlock(*rtcpParser, rtcpPacketInformation); break; - case RTCPPacketTypes::kXrVoipMetric: - HandleXRVOIPMetric(*rtcpParser, rtcpPacketInformation); - break; case RTCPPacketTypes::kBye: HandleBYE(*rtcpParser); break; @@ -341,23 +338,12 @@ int32_t RTCPReceiver::IncomingRTCPPacket( 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; @@ -909,49 +895,6 @@ void RTCPReceiver::HandleXrDlrrReportBlockItem( rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpXrDlrrReportBlock; } -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; - - 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.rtcpPacketTypeFlags |= - kRtcpXrVoipMetric; // received signal - } - rtcpParser.Iterate(); -} - void RTCPReceiver::HandlePLI(RTCPUtility::RTCPParserV2& rtcpParser, RTCPPacketInformation& rtcpPacketInformation) { const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); @@ -1118,24 +1061,6 @@ void RTCPReceiver::HandlePsfbApp(RTCPUtility::RTCPParserV2& rtcpParser, } } -void RTCPReceiver::HandleIJ(RTCPUtility::RTCPParserV2& rtcpParser, - RTCPPacketInformation& rtcpPacketInformation) { - const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); - - RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); - while (pktType == RTCPPacketTypes::kExtendedIjItem) { - HandleIJItem(rtcpPacket, rtcpPacketInformation); - pktType = rtcpParser.Iterate(); - } -} - -void RTCPReceiver::HandleIJItem(const RTCPUtility::RTCPPacket& rtcpPacket, - RTCPPacketInformation& rtcpPacketInformation) { - rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTransmissionTimeOffset; - rtcpPacketInformation.interArrivalJitter = - rtcpPacket.ExtendedJitterReportItem.Jitter; -} - void RTCPReceiver::HandleREMBItem( RTCPUtility::RTCPParserV2& rtcpParser, RTCPPacketInformation& rtcpPacketInformation) { @@ -1190,27 +1115,6 @@ void RTCPReceiver::HandleFIRItem(RTCPReceiveInformation* receiveInfo, } } -void RTCPReceiver::HandleAPP(RTCPUtility::RTCPParserV2& rtcpParser, - RTCPPacketInformation& rtcpPacketInformation) { - const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); - - rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpApp; - rtcpPacketInformation.applicationSubType = rtcpPacket.APP.SubType; - rtcpPacketInformation.applicationName = rtcpPacket.APP.Name; - - rtcpParser.Iterate(); -} - -void RTCPReceiver::HandleAPPItem(RTCPUtility::RTCPParserV2& rtcpParser, - RTCPPacketInformation& rtcpPacketInformation) { - const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); - - rtcpPacketInformation.AddApplicationData(rtcpPacket.APP.Data, - rtcpPacket.APP.Size); - - rtcpParser.Iterate(); -} - void RTCPReceiver::HandleTransportFeedback( RTCPUtility::RTCPParserV2* rtcp_parser, RTCPHelp::RTCPPacketInformation* rtcp_packet_information) { diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h index e9d2c94b7c..ace82f043d 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h @@ -168,11 +168,6 @@ class RTCPReceiver { 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); @@ -208,14 +203,6 @@ class RTCPReceiver { 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); @@ -247,14 +234,6 @@ class RTCPReceiver { 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) diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc index 749ff25ad3..8edab5c1d9 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc @@ -23,12 +23,7 @@ RTCPPacketInformation::RTCPPacketInformation() : rtcpPacketTypeFlags(0), remoteSSRC(0), nackSequenceNumbers(), - applicationSubType(0), - applicationName(0), - applicationData(), - applicationLength(0), rtt(0), - interArrivalJitter(0), sliPictureId(0), rpsiPictureId(0), receiverEstimatedMaxBitrate(0), @@ -36,40 +31,9 @@ RTCPPacketInformation::RTCPPacketInformation() ntp_frac(0), rtp_timestamp(0), xr_originator_ssrc(0), - xr_dlrr_item(false), - VoIPMetric(nullptr) {} + xr_dlrr_item(false) {} -RTCPPacketInformation::~RTCPPacketInformation() { - delete[] applicationData; -} - -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; - - // 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]; - - if (oldData) { - memcpy(applicationData, oldData, oldLength); - memcpy(applicationData + oldLength, data, copySize); - delete[] oldData; - } else { - memcpy(applicationData, data, copySize); - } -} +RTCPPacketInformation::~RTCPPacketInformation() {} void RTCPPacketInformation::ResetNACKPacketIdArray() { nackSequenceNumbers.clear(); diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h index 35db67c104..e0947f03ed 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h @@ -48,10 +48,6 @@ class RTCPPacketInformation { RTCPPacketInformation(); ~RTCPPacketInformation(); - void AddVoIPMetric(const RTCPVoIPMetric* metric); - - void AddApplicationData(const uint8_t* data, const uint16_t size); - void AddNACKPacket(const uint16_t packetID); void ResetNACKPacketIdArray(); @@ -62,16 +58,9 @@ class RTCPPacketInformation { std::vector nackSequenceNumbers; - uint8_t applicationSubType; - uint32_t applicationName; - uint8_t* applicationData; - uint16_t applicationLength; - ReportBlockList report_blocks; int64_t rtt; - uint32_t interArrivalJitter; - uint8_t sliPictureId; uint64_t rpsiPictureId; uint32_t receiverEstimatedMaxBitrate; @@ -82,7 +71,6 @@ class RTCPPacketInformation { uint32_t xr_originator_ssrc; bool xr_dlrr_item; - std::unique_ptr VoIPMetric; std::unique_ptr transport_feedback_;