Don't report an error for GetEstimatedReceiveBandwidth if there is no valid

estimate.

BUG=1377

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3479 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org 2013-02-06 17:46:39 +00:00
parent fe3d606f15
commit 4fd5527ab1
6 changed files with 17 additions and 15 deletions

View File

@ -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;

View File

@ -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],

View File

@ -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);

View File

@ -10,6 +10,8 @@
#include "video_engine/vie_receiver.h"
#include <vector>
#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<unsigned int> 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

View File

@ -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);

View File

@ -860,8 +860,9 @@ int ViERTP_RTCPImpl::GetEstimatedReceiveBandwidth(
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
return -1;
}
return vie_channel->GetEstimatedReceiveBandwidth(
vie_channel->GetEstimatedReceiveBandwidth(
static_cast<WebRtc_UWord32*>(estimated_bandwidth));
return 0;
}
int ViERTP_RTCPImpl::SetOverUseDetectorOptions(