Adjust RtcpReceiver to be testable with callbacks:
Instead of full RtpRtcpImpl takes interface of all functions it needs from it.
Added single function for parsing packets and sending feedback, moving that
logic from RtpRtcpImpl to RtcpReceiver.
BUG=webrtc:5260
Review-Url: https://codereview.webrtc.org/2274573002
Cr-Commit-Position: refs/heads/master@{#13960}
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index ba7ca7e..78ad5a0 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -223,21 +223,7 @@
int32_t ModuleRtpRtcpImpl::IncomingRtcpPacket(
const uint8_t* rtcp_packet,
const size_t length) {
- // Allow receive of non-compound RTCP packets.
- RTCPUtility::RTCPParserV2 rtcp_parser(rtcp_packet, length, true);
-
- const bool valid_rtcpheader = rtcp_parser.IsValid();
- if (!valid_rtcpheader) {
- LOG(LS_WARNING) << "Incoming invalid RTCP packet";
- return -1;
- }
- RTCPHelp::RTCPPacketInformation rtcp_packet_information;
- int32_t ret_val =
- rtcp_receiver_.IncomingRTCPPacket(rtcp_packet_information, &rtcp_parser);
- if (ret_val == 0) {
- rtcp_receiver_.TriggerCallbacksFromRTCPPacket(rtcp_packet_information);
- }
- return ret_val;
+ return rtcp_receiver_.IncomingPacket(rtcp_packet, length) ? 0 : -1;
}
int32_t ModuleRtpRtcpImpl::RegisterSendPayload(