diff --git a/webrtc/video_engine/include/vie_rtp_rtcp.h b/webrtc/video_engine/include/vie_rtp_rtcp.h index 83b6f57b15..88c04e027e 100644 --- a/webrtc/video_engine/include/vie_rtp_rtcp.h +++ b/webrtc/video_engine/include/vie_rtp_rtcp.h @@ -281,8 +281,8 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP { unsigned int* estimated_bandwidth) const = 0; // This function gets the receive-side estimated bandwidth available for - // video, including overhead, in bits/s. - // Returns -1 when no valid estimate is available. + // video, including overhead, in bits/s. |estimated_bandwidth| is 0 if there + // is no valid estimate. virtual int GetEstimatedReceiveBandwidth( const int video_channel, unsigned int* estimated_bandwidth) const = 0; diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index b3e1b7eb20..fa8ce91988 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -1199,11 +1199,9 @@ void ViEChannel::GetBandwidthUsage(uint32_t* total_bitrate_sent, } } -int ViEChannel::GetEstimatedReceiveBandwidth( +void ViEChannel::GetEstimatedReceiveBandwidth( uint32_t* estimated_bandwidth) const { - if (!vie_receiver_.EstimatedReceiveBandwidth(estimated_bandwidth)) - return -1; - return 0; + vie_receiver_.EstimatedReceiveBandwidth(estimated_bandwidth); } WebRtc_Word32 ViEChannel::StartRTPDump(const char file_nameUTF8[1024], diff --git a/webrtc/video_engine/vie_channel.h b/webrtc/video_engine/vie_channel.h index 5eec802b1f..9db2b5d454 100644 --- a/webrtc/video_engine/vie_channel.h +++ b/webrtc/video_engine/vie_channel.h @@ -181,7 +181,7 @@ class ViEChannel uint32_t* video_bitrate_sent, uint32_t* fec_bitrate_sent, uint32_t* nackBitrateSent) const; - int GetEstimatedReceiveBandwidth(uint32_t* estimated_bandwidth) const; + void GetEstimatedReceiveBandwidth(uint32_t* estimated_bandwidth) const; WebRtc_Word32 StartRTPDump(const char file_nameUTF8[1024], RTPDirections direction); diff --git a/webrtc/video_engine/vie_receiver.cc b/webrtc/video_engine/vie_receiver.cc index 89ad655da1..43aa566164 100644 --- a/webrtc/video_engine/vie_receiver.cc +++ b/webrtc/video_engine/vie_receiver.cc @@ -10,6 +10,8 @@ #include "video_engine/vie_receiver.h" +#include + #include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "modules/rtp_rtcp/interface/rtp_rtcp.h" #include "modules/utility/interface/rtp_dump.h" @@ -285,17 +287,18 @@ int ViEReceiver::StopRTPDump() { } // TODO(holmer): To be moved to ViEChannelGroup. -bool ViEReceiver::EstimatedReceiveBandwidth( +void ViEReceiver::EstimatedReceiveBandwidth( unsigned int* available_bandwidth) const { std::vector ssrcs; - if (!remote_bitrate_estimator_->LatestEstimate(&ssrcs, - available_bandwidth)) { - return false; - } + + // LatestEstimate returns an error if there is no valid bitrate estimate, but + // ViEReceiver instead returns a zero estimate. + remote_bitrate_estimator_->LatestEstimate(&ssrcs, available_bandwidth); if (!ssrcs.empty()) { *available_bandwidth /= ssrcs.size(); + } else { + *available_bandwidth = 0; } - return true; } } // namespace webrtc diff --git a/webrtc/video_engine/vie_receiver.h b/webrtc/video_engine/vie_receiver.h index 5eecfb3c2a..4f43fc9d67 100644 --- a/webrtc/video_engine/vie_receiver.h +++ b/webrtc/video_engine/vie_receiver.h @@ -74,7 +74,7 @@ class ViEReceiver : public UdpTransportData, public RtpData { uint32_t ntp_frac, uint32_t timestamp); - bool EstimatedReceiveBandwidth(unsigned int* available_bandwidth) const; + void EstimatedReceiveBandwidth(unsigned int* available_bandwidth) const; private: int InsertRTPPacket(const WebRtc_Word8* rtp_packet, int rtp_packet_length); diff --git a/webrtc/video_engine/vie_rtp_rtcp_impl.cc b/webrtc/video_engine/vie_rtp_rtcp_impl.cc index 7bd6f6d2ec..f04e0e75cc 100644 --- a/webrtc/video_engine/vie_rtp_rtcp_impl.cc +++ b/webrtc/video_engine/vie_rtp_rtcp_impl.cc @@ -860,8 +860,9 @@ int ViERTP_RTCPImpl::GetEstimatedReceiveBandwidth( shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); return -1; } - return vie_channel->GetEstimatedReceiveBandwidth( + vie_channel->GetEstimatedReceiveBandwidth( static_cast(estimated_bandwidth)); + return 0; } int ViERTP_RTCPImpl::SetOverUseDetectorOptions(