Update receive only channels with RTT.
vie_autotest_loopback.cc will not be part of the commit, it's only to show the test. TEST=temporary with attached loopback test. Review URL: https://webrtc-codereview.appspot.com/390007 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1678 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
e8b1a0f188
commit
d7d46887a6
@ -46,7 +46,8 @@ RTCPReceiver::RTCPReceiver(const WebRtc_Word32 id,
|
||||
_lastReceivedSRNTPsecs(0),
|
||||
_lastReceivedSRNTPfrac(0),
|
||||
_receivedInfoMap(),
|
||||
_packetTimeOutMS(0)
|
||||
_packetTimeOutMS(0),
|
||||
_rtt(0)
|
||||
{
|
||||
memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo));
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__);
|
||||
@ -191,6 +192,23 @@ WebRtc_Word32 RTCPReceiver::RTT(const WebRtc_UWord32 remoteSSRC,
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_UWord16 RTCPReceiver::RTT() const {
|
||||
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
|
||||
if (!_receivedReportBlockMap.empty()) {
|
||||
return 0;
|
||||
}
|
||||
return _rtt;
|
||||
}
|
||||
|
||||
int RTCPReceiver::SetRTT(WebRtc_UWord16 rtt) {
|
||||
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
|
||||
if (!_receivedReportBlockMap.empty()) {
|
||||
return -1;
|
||||
}
|
||||
_rtt = rtt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
RTCPReceiver::UpdateLipSync(const WebRtc_Word32 audioVideoOffset) const
|
||||
{
|
||||
|
@ -69,6 +69,10 @@ public:
|
||||
WebRtc_UWord16* minRTT,
|
||||
WebRtc_UWord16* maxRTT) const;
|
||||
|
||||
WebRtc_UWord16 RTT() const;
|
||||
|
||||
int SetRTT(WebRtc_UWord16 rtt);
|
||||
|
||||
WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC);
|
||||
|
||||
void UpdateLipSync(const WebRtc_Word32 audioVideoOffset) const;
|
||||
@ -219,6 +223,11 @@ protected:
|
||||
_receivedCnameMap;
|
||||
|
||||
WebRtc_UWord32 _packetTimeOutMS;
|
||||
|
||||
// Externally set RTT. This value can only be used if there are no valid
|
||||
// RTT estimates.
|
||||
WebRtc_UWord16 _rtt;
|
||||
|
||||
};
|
||||
} // namespace webrtc
|
||||
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_
|
||||
|
@ -34,6 +34,8 @@ const float FracMS = 4.294967296E6f;
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
const WebRtc_UWord16 kDefaultRtt = 200;
|
||||
|
||||
RtpRtcp* RtpRtcp::CreateRtpRtcp(const WebRtc_Word32 id,
|
||||
const bool audio) {
|
||||
return CreateRtpRtcp(id, audio, ModuleRTPUtility::GetSystemClock());
|
||||
@ -378,14 +380,33 @@ WebRtc_Word32 ModuleRtpRtcpImpl::Process() {
|
||||
|
||||
const bool defaultInstance(_childModules.empty() ? false : true);
|
||||
if (!defaultInstance && _rtcpSender.TimeToSendRTCPReport()) {
|
||||
WebRtc_UWord16 RTT = 0;
|
||||
_rtcpReceiver.RTT(_rtpReceiver.SSRC(), &RTT, NULL, NULL, NULL);
|
||||
WebRtc_UWord16 max_rtt = 0;
|
||||
if (_rtcpSender.Sending()) {
|
||||
std::vector<RTCPReportBlock> receive_blocks;
|
||||
_rtcpReceiver.StatisticsReceived(&receive_blocks);
|
||||
for (std::vector<RTCPReportBlock>::iterator it = receive_blocks.begin();
|
||||
it != receive_blocks.end(); ++it) {
|
||||
WebRtc_UWord16 rtt = 0;
|
||||
_rtcpReceiver.RTT(it->remoteSSRC, &max_rtt, NULL, NULL, NULL);
|
||||
max_rtt = (rtt > max_rtt) ? rtt : max_rtt;
|
||||
}
|
||||
} else {
|
||||
// We're only receiving, i.e. this module doesn't have its own RTT
|
||||
// estimate. Use the RTT set by a sending channel using the same default
|
||||
// module.
|
||||
max_rtt = _rtcpReceiver.RTT();
|
||||
}
|
||||
if (max_rtt == 0) {
|
||||
// No valid estimate available, i.e. no sending channel using the same
|
||||
// default module or no RTCP received yet.
|
||||
max_rtt = kDefaultRtt;
|
||||
}
|
||||
if (REMB() && _rtcpSender.ValidBitrateEstimate()) {
|
||||
unsigned int target_bitrate =
|
||||
_rtcpSender.CalculateNewTargetBitrate(RTT);
|
||||
_rtcpSender.CalculateNewTargetBitrate(max_rtt);
|
||||
_rtcpSender.UpdateRemoteBitrateEstimate(target_bitrate);
|
||||
} else if (TMMBR()) {
|
||||
_rtcpSender.CalculateNewTargetBitrate(RTT);
|
||||
_rtcpSender.CalculateNewTargetBitrate(max_rtt);
|
||||
}
|
||||
_rtcpSender.SendRTCP(kRtcpReport);
|
||||
}
|
||||
@ -2758,6 +2779,20 @@ void ModuleRtpRtcpImpl::ProcessDefaultModuleBandwidth() {
|
||||
// No sending modules and no bitrate estimate.
|
||||
return;
|
||||
}
|
||||
|
||||
// Update RTT to all receive only child modules, they won't have their own RTT
|
||||
// estimate. Assume the receive only channels are on similar links as the
|
||||
// sending channel and have approximately the same RTT.
|
||||
{
|
||||
CriticalSectionScoped lock(_criticalSectionModulePtrs);
|
||||
for (std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
|
||||
it != _childModules.end(); ++it) {
|
||||
if (!(*it)->Sending()) {
|
||||
(*it)->_rtcpReceiver.SetRTT(maxRoundTripTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_bandwidthManagement.SetSendBitrate(minBitrateBps, 0, 0);
|
||||
|
||||
// Update default module bitrate. Don't care about min max.
|
||||
|
Loading…
x
Reference in New Issue
Block a user