Only trigger one call to OnNetworkChanged for each incoming RTCP packet.
Review URL: http://webrtc-codereview.appspot.com/289004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1016 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -1278,10 +1278,17 @@ RTCPReceiver::TriggerCallbacksFromRTCPPacket(RTCPPacketInformation& rtcpPacketIn
|
|||||||
{
|
{
|
||||||
if(rtcpPacketInformation.reportBlock)
|
if(rtcpPacketInformation.reportBlock)
|
||||||
{
|
{
|
||||||
|
// We only want to trigger one OnNetworkChanged callback per RTCP
|
||||||
|
// packet. The callback is triggered by a SR, RR and TMMBR, so we
|
||||||
|
// don't want to trigger one from here if the packet also contains a
|
||||||
|
// TMMBR block.
|
||||||
|
bool triggerCallback =
|
||||||
|
!(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpTmmbr);
|
||||||
_rtpRtcp.OnPacketLossStatisticsUpdate(
|
_rtpRtcp.OnPacketLossStatisticsUpdate(
|
||||||
rtcpPacketInformation.fractionLost,
|
rtcpPacketInformation.fractionLost,
|
||||||
rtcpPacketInformation.roundTripTime,
|
rtcpPacketInformation.roundTripTime,
|
||||||
rtcpPacketInformation.lastReceivedExtendedHighSeqNum);
|
rtcpPacketInformation.lastReceivedExtendedHighSeqNum,
|
||||||
|
triggerCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpSr)
|
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpSr)
|
||||||
|
@ -2633,7 +2633,7 @@ void ModuleRtpRtcpImpl::OnReceivedBandwidthEstimateUpdate(
|
|||||||
// We received a TMMBR
|
// We received a TMMBR
|
||||||
const bool defaultInstance(_childModules.empty() ? false : true);
|
const bool defaultInstance(_childModules.empty() ? false : true);
|
||||||
if (defaultInstance) {
|
if (defaultInstance) {
|
||||||
ProcessDefaultModuleBandwidth();
|
ProcessDefaultModuleBandwidth(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_audio) {
|
if (_audio) {
|
||||||
@ -2674,7 +2674,8 @@ void ModuleRtpRtcpImpl::OnReceivedBandwidthEstimateUpdate(
|
|||||||
void ModuleRtpRtcpImpl::OnPacketLossStatisticsUpdate(
|
void ModuleRtpRtcpImpl::OnPacketLossStatisticsUpdate(
|
||||||
const WebRtc_UWord8 fractionLost,
|
const WebRtc_UWord8 fractionLost,
|
||||||
const WebRtc_UWord16 roundTripTime,
|
const WebRtc_UWord16 roundTripTime,
|
||||||
const WebRtc_UWord32 lastReceivedExtendedHighSeqNum) {
|
const WebRtc_UWord32 lastReceivedExtendedHighSeqNum,
|
||||||
|
bool triggerOnNetworkChanged) {
|
||||||
|
|
||||||
const bool defaultInstance(_childModules.empty() ? false : true);
|
const bool defaultInstance(_childModules.empty() ? false : true);
|
||||||
if (!defaultInstance) {
|
if (!defaultInstance) {
|
||||||
@ -2709,18 +2710,22 @@ void ModuleRtpRtcpImpl::OnPacketLossStatisticsUpdate(
|
|||||||
_defaultModule->OnPacketLossStatisticsUpdate(
|
_defaultModule->OnPacketLossStatisticsUpdate(
|
||||||
loss, // send in the filtered loss
|
loss, // send in the filtered loss
|
||||||
roundTripTime,
|
roundTripTime,
|
||||||
lastReceivedExtendedHighSeqNum);
|
lastReceivedExtendedHighSeqNum,
|
||||||
|
triggerOnNetworkChanged);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// No default module check if we should trigger OnNetworkChanged
|
// No default module check if we should trigger OnNetworkChanged
|
||||||
// via video callback
|
// via video callback
|
||||||
_rtpReceiver.UpdateBandwidthManagement(newBitrate,
|
if (triggerOnNetworkChanged)
|
||||||
fractionLost,
|
{
|
||||||
roundTripTime);
|
_rtpReceiver.UpdateBandwidthManagement(newBitrate,
|
||||||
|
fractionLost,
|
||||||
|
roundTripTime);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!_simulcast) {
|
if (!_simulcast) {
|
||||||
ProcessDefaultModuleBandwidth();
|
ProcessDefaultModuleBandwidth(triggerOnNetworkChanged);
|
||||||
} else {
|
} else {
|
||||||
// default and simulcast
|
// default and simulcast
|
||||||
WebRtc_UWord32 newBitrate = 0;
|
WebRtc_UWord32 newBitrate = 0;
|
||||||
@ -2740,9 +2745,12 @@ void ModuleRtpRtcpImpl::OnPacketLossStatisticsUpdate(
|
|||||||
_rtpSender.SetTargetSendBitrate(newBitrate);
|
_rtpSender.SetTargetSendBitrate(newBitrate);
|
||||||
// check if we should trigger OnNetworkChanged
|
// check if we should trigger OnNetworkChanged
|
||||||
// via video callback
|
// via video callback
|
||||||
_rtpReceiver.UpdateBandwidthManagement(newBitrate,
|
if (triggerOnNetworkChanged)
|
||||||
loss,
|
{
|
||||||
roundTripTime);
|
_rtpReceiver.UpdateBandwidthManagement(newBitrate,
|
||||||
|
loss,
|
||||||
|
roundTripTime);
|
||||||
|
}
|
||||||
// sanity
|
// sanity
|
||||||
if (_sendVideoCodec.codecType == kVideoCodecUnknown) {
|
if (_sendVideoCodec.codecType == kVideoCodecUnknown) {
|
||||||
return;
|
return;
|
||||||
@ -2779,7 +2787,9 @@ void ModuleRtpRtcpImpl::OnPacketLossStatisticsUpdate(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModuleRtpRtcpImpl::ProcessDefaultModuleBandwidth() {
|
void ModuleRtpRtcpImpl::ProcessDefaultModuleBandwidth(
|
||||||
|
bool triggerOnNetworkChanged) {
|
||||||
|
|
||||||
WebRtc_UWord32 minBitrateBps = 0xffffffff;
|
WebRtc_UWord32 minBitrateBps = 0xffffffff;
|
||||||
WebRtc_UWord32 maxBitrateBps = 0;
|
WebRtc_UWord32 maxBitrateBps = 0;
|
||||||
WebRtc_UWord32 count = 0;
|
WebRtc_UWord32 count = 0;
|
||||||
@ -2833,12 +2843,15 @@ void ModuleRtpRtcpImpl::ProcessDefaultModuleBandwidth() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_bandwidthManagement.SetSendBitrate(minBitrateBps, 0, 0);
|
_bandwidthManagement.SetSendBitrate(minBitrateBps, 0, 0);
|
||||||
// Update default module bitrate. Don't care about min max.
|
|
||||||
// Check if we should trigger OnNetworkChanged via video callback
|
if (triggerOnNetworkChanged) {
|
||||||
WebRtc_UWord8 fractionLostAvg = WebRtc_UWord8(fractionLostAcc / count);
|
// Update default module bitrate. Don't care about min max.
|
||||||
_rtpReceiver.UpdateBandwidthManagement(minBitrateBps,
|
// Check if we should trigger OnNetworkChanged via video callback
|
||||||
fractionLostAvg ,
|
WebRtc_UWord8 fractionLostAvg = WebRtc_UWord8(fractionLostAcc / count);
|
||||||
maxRoundTripTime);
|
_rtpReceiver.UpdateBandwidthManagement(minBitrateBps,
|
||||||
|
fractionLostAvg ,
|
||||||
|
maxRoundTripTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModuleRtpRtcpImpl::OnRequestSendReport() {
|
void ModuleRtpRtcpImpl::OnRequestSendReport() {
|
||||||
|
@ -481,7 +481,8 @@ public:
|
|||||||
void OnPacketLossStatisticsUpdate(
|
void OnPacketLossStatisticsUpdate(
|
||||||
const WebRtc_UWord8 fractionLost,
|
const WebRtc_UWord8 fractionLost,
|
||||||
const WebRtc_UWord16 roundTripTime,
|
const WebRtc_UWord16 roundTripTime,
|
||||||
const WebRtc_UWord32 lastReceivedExtendedHighSeqNum);
|
const WebRtc_UWord32 lastReceivedExtendedHighSeqNum,
|
||||||
|
bool triggerOnNetworkChanged);
|
||||||
|
|
||||||
void OnReceivedTMMBR();
|
void OnReceivedTMMBR();
|
||||||
|
|
||||||
@ -532,7 +533,7 @@ protected:
|
|||||||
RTCPReceiver _rtcpReceiver;
|
RTCPReceiver _rtcpReceiver;
|
||||||
private:
|
private:
|
||||||
void SendKeyFrame();
|
void SendKeyFrame();
|
||||||
void ProcessDefaultModuleBandwidth();
|
void ProcessDefaultModuleBandwidth(bool triggerOnNetworkChanged);
|
||||||
|
|
||||||
WebRtc_Word32 _id;
|
WebRtc_Word32 _id;
|
||||||
const bool _audio;
|
const bool _audio;
|
||||||
|
Reference in New Issue
Block a user