Remove TimeToSendPacket and TimeToSendPadding from the default module.

Thie CL moves the default RTP module logic for TimeToSendPacket and
TimeToSendPadding to PayloadRouter class and asserts on usage of the
default module.

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

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

Cr-Commit-Position: refs/heads/master@{#8383}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8383 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org
2015-02-17 10:15:06 +00:00
parent c0fc4dd87c
commit 290cb56dca
7 changed files with 216 additions and 52 deletions

View File

@ -501,42 +501,18 @@ bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
uint16_t sequence_number,
int64_t capture_time_ms,
bool retransmission) {
if (!IsDefaultModule()) {
// Don't send from default module.
if (SendingMedia() && ssrc == rtp_sender_.SSRC()) {
return rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms,
retransmission);
}
} else {
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
std::vector<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
while (it != child_modules_.end()) {
if ((*it)->SendingMedia() && ssrc == (*it)->rtp_sender_.SSRC()) {
return (*it)->rtp_sender_.TimeToSendPacket(sequence_number,
capture_time_ms,
retransmission);
}
++it;
}
assert(!IsDefaultModule());
if (SendingMedia() && ssrc == rtp_sender_.SSRC()) {
return rtp_sender_.TimeToSendPacket(
sequence_number, capture_time_ms, retransmission);
}
// No RTP sender is interested in sending this packet.
return true;
}
size_t ModuleRtpRtcpImpl::TimeToSendPadding(size_t bytes) {
if (!IsDefaultModule()) {
// Don't send from default module.
return rtp_sender_.TimeToSendPadding(bytes);
} else {
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
for (size_t i = 0; i < child_modules_.size(); ++i) {
// Send padding on one of the modules sending media.
if (child_modules_[i]->SendingMedia()) {
return child_modules_[i]->rtp_sender_.TimeToSendPadding(bytes);
}
}
}
return 0;
assert(!IsDefaultModule());
return rtp_sender_.TimeToSendPadding(bytes);
}
bool ModuleRtpRtcpImpl::GetSendSideDelay(int* avg_send_delay_ms,