Wire up pacer-based padding.
This connects the pacer-based padding with the RTP modules, which will generate padding packets roughly according to what the pacer suggests. It will only generate padding packets of maximum size to keep the number off padding packets as small as possible. This also sets a limit of how much padding + media bitrate which the pacer is allowed to "request" from the RTP modules. Padding will for now only be generated by the first sending RTP module. BUG=1837 R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1612005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4234 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -977,7 +977,17 @@ void ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
|
||||
"TimeToSendPacket(ssrc:0x%x sequence_number:%u capture_time_ms:%ll)",
|
||||
ssrc, sequence_number, capture_time_ms);
|
||||
|
||||
if (simulcast_) {
|
||||
bool no_child_modules = false;
|
||||
{
|
||||
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
||||
no_child_modules = !child_modules_.empty();
|
||||
}
|
||||
if (no_child_modules) {
|
||||
// Don't send from default module.
|
||||
if (SendingMedia() && ssrc == rtp_sender_.SSRC()) {
|
||||
rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms);
|
||||
}
|
||||
} else {
|
||||
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
||||
std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
|
||||
while (it != child_modules_.end()) {
|
||||
@@ -987,25 +997,35 @@ void ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ModuleRtpRtcpImpl::TimeToSendPadding(int bytes) {
|
||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_, "TimeToSendPadding(bytes: %d)",
|
||||
bytes);
|
||||
|
||||
bool no_child_modules = false;
|
||||
{
|
||||
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
||||
no_child_modules = child_modules_.empty();
|
||||
}
|
||||
if (no_child_modules) {
|
||||
// Don't send from default module.
|
||||
if (SendingMedia()) {
|
||||
return rtp_sender_.TimeToSendPadding(bytes);
|
||||
}
|
||||
} else {
|
||||
bool have_child_modules = !child_modules_.empty();
|
||||
if (!have_child_modules) {
|
||||
// Don't send from default module.
|
||||
if (SendingMedia() && ssrc == rtp_sender_.SSRC()) {
|
||||
rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms);
|
||||
}
|
||||
} else {
|
||||
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
||||
std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
|
||||
while (it != child_modules_.end()) {
|
||||
if ((*it)->SendingMedia() && ssrc == (*it)->rtp_sender_.SSRC()) {
|
||||
(*it)->rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms);
|
||||
return;
|
||||
}
|
||||
++it;
|
||||
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
||||
std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
|
||||
while (it != child_modules_.end()) {
|
||||
// Send padding on one of the modules sending media.
|
||||
if ((*it)->SendingMedia()) {
|
||||
return (*it)->rtp_sender_.TimeToSendPadding(bytes);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t ModuleRtpRtcpImpl::MaxPayloadLength() const {
|
||||
|
Reference in New Issue
Block a user