Implementing a packet router class, used to route RTP packets to the

sending RTP module for the specified simulcast layer a frame belongs to.
This CL also removes the corresponding functionality from the RTP RTCP
module and fixes lint warnings in the files touched.

BUG=769
TEST=New unittest and manual tests
R=stefan@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8267}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8267 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org
2015-02-06 13:10:19 +00:00
parent 10a9e924eb
commit 02270cd718
11 changed files with 349 additions and 72 deletions

View File

@ -13,6 +13,8 @@
#include <assert.h>
#include <string.h>
#include <set>
#include "webrtc/common_types.h"
#include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/trace.h"
@ -491,74 +493,21 @@ int32_t ModuleRtpRtcpImpl::SendOutgoingData(
size_t payload_size,
const RTPFragmentationHeader* fragmentation,
const RTPVideoHeader* rtp_video_hdr) {
rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms);
assert(!IsDefaultModule());
if (!IsDefaultModule()) {
// Don't send RTCP from default module.
if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) {
rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms);
if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) {
rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport);
}
return rtp_sender_.SendOutgoingData(frame_type,
payload_type,
time_stamp,
capture_time_ms,
payload_data,
payload_size,
fragmentation,
NULL,
&(rtp_video_hdr->codecHeader));
}
int32_t ret_val = -1;
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
if (simulcast_) {
if (rtp_video_hdr == NULL) {
return -1;
}
int idx = 0;
std::vector<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
for (; idx < rtp_video_hdr->simulcastIdx; ++it) {
if (it == child_modules_.end()) {
return -1;
}
if ((*it)->SendingMedia()) {
++idx;
}
}
for (; it != child_modules_.end(); ++it) {
if ((*it)->SendingMedia()) {
break;
}
++idx;
}
if (it == child_modules_.end()) {
return -1;
}
return (*it)->SendOutgoingData(frame_type,
payload_type,
time_stamp,
capture_time_ms,
payload_data,
payload_size,
fragmentation,
rtp_video_hdr);
} else {
std::vector<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
// Send to all "child" modules
while (it != child_modules_.end()) {
if ((*it)->SendingMedia()) {
ret_val = (*it)->SendOutgoingData(frame_type,
payload_type,
time_stamp,
capture_time_ms,
payload_data,
payload_size,
fragmentation,
rtp_video_hdr);
}
it++;
}
}
return ret_val;
return rtp_sender_.SendOutgoingData(frame_type,
payload_type,
time_stamp,
capture_time_ms,
payload_data,
payload_size,
fragmentation,
NULL,
&(rtp_video_hdr->codecHeader));
}
bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
@ -1346,4 +1295,4 @@ bool ModuleRtpRtcpImpl::IsDefaultModule() const {
return !child_modules_.empty();
}
} // Namespace webrtc
} // namespace webrtc