Add APIs for getting receive-side estimated bandwidth and codec target rate.

BUG=
TEST=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1704 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2012-02-16 14:45:37 +00:00
parent 6f5f9ffb30
commit 439be29445
23 changed files with 227 additions and 83 deletions

View File

@ -569,7 +569,13 @@ public:
/*
* Get the send-side estimate of the available bandwidth.
*/
virtual int EstimatedBandwidth(
virtual int EstimatedSendBandwidth(
WebRtc_UWord32* available_bandwidth) const = 0;
/*
* Get the receive-side estimate of the available bandwidth.
*/
virtual int EstimatedReceiveBandwidth(
WebRtc_UWord32* available_bandwidth) const = 0;
/*

View File

@ -142,7 +142,9 @@ class MockRtpRtcp : public RtpRtcp {
bool());
MOCK_CONST_METHOD4(BitrateSent,
void(WebRtc_UWord32* totalRate, WebRtc_UWord32* videoRate, WebRtc_UWord32* fecRate, WebRtc_UWord32* nackRate));
MOCK_CONST_METHOD1(EstimatedBandwidth,
MOCK_CONST_METHOD1(EstimatedSendBandwidth,
int(WebRtc_UWord32* available_bandwidth));
MOCK_CONST_METHOD1(EstimatedReceiveBandwidth,
int(WebRtc_UWord32* available_bandwidth));
MOCK_METHOD7(SendOutgoingData,
WebRtc_Word32(const FrameType frameType, const WebRtc_Word8 payloadType, const WebRtc_UWord32 timeStamp, const WebRtc_UWord8* payloadData, const WebRtc_UWord32 payloadSize, const RTPFragmentationHeader* fragmentation, const RTPVideoHeader* rtpVideoHdr));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -79,7 +79,7 @@ void RemoteRateControl::Reset()
_initializedBitRate = false;
}
bool RemoteRateControl::ValidEstimate() {
bool RemoteRateControl::ValidEstimate() const {
return _initializedBitRate;
}
@ -95,7 +95,11 @@ WebRtc_Word32 RemoteRateControl::SetConfiguredBitRates(WebRtc_UWord32 minBitRate
return 0;
}
WebRtc_UWord32 RemoteRateControl::TargetBitRate(WebRtc_UWord32 RTT,
WebRtc_UWord32 RemoteRateControl::LatestEstimate() const {
return _currentBitRate;
}
WebRtc_UWord32 RemoteRateControl::UpdateBandwidthEstimate(WebRtc_UWord32 RTT,
WebRtc_Word64 nowMS)
{
_currentBitRate = ChangeBitRate(_currentBitRate, _currentInput._incomingBitRate,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -24,22 +24,28 @@ class RemoteRateControl
public:
RemoteRateControl();
~RemoteRateControl();
WebRtc_Word32 SetConfiguredBitRates(WebRtc_UWord32 minBitRate, WebRtc_UWord32 maxBitRate);
WebRtc_UWord32 TargetBitRate(WebRtc_UWord32 RTT, WebRtc_Word64 nowMS);
WebRtc_Word32 SetConfiguredBitRates(WebRtc_UWord32 minBitRate,
WebRtc_UWord32 maxBitRate);
WebRtc_UWord32 LatestEstimate() const;
WebRtc_UWord32 UpdateBandwidthEstimate(WebRtc_UWord32 RTT,
WebRtc_Word64 nowMS);
RateControlRegion Update(const RateControlInput& input, bool& firstOverUse,
WebRtc_Word64 nowMS);
void Reset();
// Returns true if there is a valid estimate of the incoming bitrate, false
// otherwise.
bool ValidEstimate();
bool ValidEstimate() const;
private:
WebRtc_UWord32 ChangeBitRate(WebRtc_UWord32 currentBitRate,
WebRtc_UWord32 incomingBitRate,
double delayFactor, WebRtc_UWord32 RTT,
WebRtc_Word64 nowMS);
double RateIncreaseFactor(WebRtc_Word64 nowMs, WebRtc_Word64 lastMs, WebRtc_UWord32 reactionTimeMs, double noiseVar) const;
double RateIncreaseFactor(WebRtc_Word64 nowMs,
WebRtc_Word64 lastMs,
WebRtc_UWord32 reactionTimeMs,
double noiseVar) const;
void UpdateChangePeriod(WebRtc_Word64 nowMs);
void UpdateMaxBitRateEstimate(float incomingBitRateKbps);
void ChangeState(const RateControlInput& input, WebRtc_Word64 nowMs);

View File

@ -1107,13 +1107,18 @@ RTCPSender::CalculateNewTargetBitrate(WebRtc_UWord32 RTT)
{
CriticalSectionScoped lock(_criticalSectionRTCPSender);
WebRtc_UWord32 target_bitrate =
_remoteRateControl.TargetBitRate(RTT, _clock.GetTimeInMS());
_remoteRateControl.UpdateBandwidthEstimate(RTT, _clock.GetTimeInMS());
_tmmbr_Send = target_bitrate / 1000;
return target_bitrate;
}
WebRtc_UWord32 RTCPSender::LatestBandwidthEstimate() const {
CriticalSectionScoped lock(_criticalSectionRTCPSender);
return _remoteRateControl.LatestEstimate();
}
bool
RTCPSender::ValidBitrateEstimate() {
RTCPSender::ValidBitrateEstimate() const {
CriticalSectionScoped lock(_criticalSectionRTCPSender);
return _remoteRateControl.ValidEstimate();
}

View File

@ -135,9 +135,11 @@ public:
WebRtc_UWord32 CalculateNewTargetBitrate(WebRtc_UWord32 RTT);
WebRtc_UWord32 LatestBandwidthEstimate() const;
// Returns true if there is a valid estimate of the incoming bitrate, false
// otherwise.
bool ValidBitrateEstimate();
bool ValidBitrateEstimate() const;
private:
WebRtc_Word32 SendToNetwork(const WebRtc_UWord8* dataBuffer,

View File

@ -2326,11 +2326,19 @@ void ModuleRtpRtcpImpl::BitrateSent(WebRtc_UWord32* totalRate,
*nackRate = _rtpSender.NackOverheadRate();
}
int ModuleRtpRtcpImpl::EstimatedBandwidth(
int ModuleRtpRtcpImpl::EstimatedSendBandwidth(
WebRtc_UWord32* available_bandwidth) const {
return _bandwidthManagement.AvailableBandwidth(available_bandwidth);
}
int ModuleRtpRtcpImpl::EstimatedReceiveBandwidth(
WebRtc_UWord32* available_bandwidth) const {
if (!_rtcpSender.ValidBitrateEstimate())
return -1;
*available_bandwidth = _rtcpSender.LatestBandwidthEstimate();
return 0;
}
// for lip sync
void ModuleRtpRtcpImpl::OnReceivedNTP() {
// don't do anything if we are the audio module

View File

@ -491,7 +491,11 @@ public:
WebRtc_UWord32* fecRate,
WebRtc_UWord32* nackRate) const;
virtual int EstimatedBandwidth(WebRtc_UWord32* available_bandwidth) const;
virtual int EstimatedSendBandwidth(
WebRtc_UWord32* available_bandwidth) const;
virtual int EstimatedReceiveBandwidth(
WebRtc_UWord32* available_bandwidth) const;
virtual void SetRemoteSSRC(const WebRtc_UWord32 SSRC);

View File

@ -146,17 +146,17 @@ public:
// < 0, on error.
virtual WebRtc_Word32 CodecConfigParameters(WebRtc_UWord8* buffer, WebRtc_Word32 size) = 0;
// API to get currently configured encoder target bit rate.
// API to get currently configured encoder target bitrate in kbit/s.
//
// Return value : The encoder target bit rate, on success.
// Return value : 0, on success.
// < 0, on error.
virtual WebRtc_UWord32 Bitrate() const = 0;
virtual int Bitrate(unsigned int* bitrate) const = 0;
// API to get currently configured encoder target frame rate.
//
// Return value : The encoder target frame rate, on success.
// Return value : 0, on success.
// < 0, on error.
virtual WebRtc_UWord32 FrameRate() const = 0;
virtual int FrameRate(unsigned int* framerate) const = 0;
// Sets the parameters describing the send channel. These parameters are inputs to the
// Media Optimization inside the VCM and also specifies the target bit rate for the

View File

@ -471,8 +471,7 @@ VideoCodingModuleImpl::CodecConfigParameters(WebRtc_UWord8* buffer,
}
// Get encode bitrate
WebRtc_UWord32
VideoCodingModuleImpl::Bitrate() const
int VideoCodingModuleImpl::Bitrate(unsigned int* bitrate) const
{
WEBRTC_TRACE(webrtc::kTraceModuleCall,
webrtc::kTraceVideoCoding,
@ -480,16 +479,15 @@ VideoCodingModuleImpl::Bitrate() const
"Bitrate()");
CriticalSectionScoped cs(_sendCritSect);
// return the bit rate which the encoder is set to
if (_encoder != NULL)
{
return _encoder->BitRate();
}
if (!_encoder) {
return VCM_UNINITIALIZED;
}
*bitrate = _encoder->BitRate();
return 0;
}
// Get encode frame rate
WebRtc_UWord32
VideoCodingModuleImpl::FrameRate() const
int VideoCodingModuleImpl::FrameRate(unsigned int* framerate) const
{
WEBRTC_TRACE(webrtc::kTraceModuleCall,
webrtc::kTraceVideoCoding,
@ -497,12 +495,12 @@ VideoCodingModuleImpl::FrameRate() const
"FrameRate()");
CriticalSectionScoped cs(_sendCritSect);
// input frame rate, not compensated
if (_encoder != NULL)
{
return _encoder->FrameRate();
}
if (!_encoder) {
return VCM_UNINITIALIZED;
}
*framerate = _encoder->FrameRate();
return 0;
}
// Set channel parameters
WebRtc_Word32

View File

@ -102,10 +102,10 @@ public:
WebRtc_Word32 size);
// Get encode bitrate
virtual WebRtc_UWord32 Bitrate() const;
virtual int Bitrate(unsigned int* bitrate) const;
// Get encode frame rate
virtual WebRtc_UWord32 FrameRate() const;
virtual int FrameRate(unsigned int* framerate) const;
// Set channel parameters
virtual WebRtc_Word32 SetChannelParameters(

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -124,6 +124,10 @@ class WEBRTC_DLLEXPORT ViECodec {
unsigned int& key_frames,
unsigned int& delta_frames) const = 0;
// Gets the bitrate targeted by the video codec rate control in kbit/s.
virtual int GetCodecTargetBitrate(const int video_channel,
unsigned int* bitrate) const = 0;
// Gets the number of packets discarded by the jitter buffer because they
// arrived too late.
virtual unsigned int GetDiscardedPackets(const int video_channel) const = 0;

View File

@ -246,7 +246,14 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP {
// This function gets the send-side estimated bandwidth available for video,
// including overhead, in bits/s.
virtual int GetEstimatedBandwidth(
virtual int GetEstimatedSendBandwidth(
const int video_channel,
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.
virtual int GetEstimatedReceiveBandwidth(
const int video_channel,
unsigned int* estimated_bandwidth) const = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -359,6 +359,11 @@ void ViEAutoTest::ViECodecAPITest()
memset(&videoCodec, 0, sizeof(videoCodec));
EXPECT_EQ(0, ptrViECodec->GetSendCodec(videoChannel, videoCodec));
EXPECT_EQ(webrtc::kVideoCodecVP8, videoCodec.codecType);
// Verify that the target bit rate is equal to the start bitrate.
unsigned int target_bitrate = 0;
EXPECT_EQ(0, ptrViECodec->GetCodecTargetBitrate(videoChannel,
&target_bitrate));
EXPECT_EQ(videoCodec.startBitrate, target_bitrate);
SetSendCodec(webrtc::kVideoCodecI420, ptrViECodec, videoChannel,
kDoNotForceResolution, kDoNotForceResolution);

View File

@ -222,7 +222,13 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
EXPECT_GT(recRttMs, 0);
unsigned int estimated_bandwidth = 0;
EXPECT_EQ(0, ViE.rtp_rtcp->GetEstimatedBandwidth(tbChannel.videoChannel,
EXPECT_EQ(0, ViE.rtp_rtcp->GetEstimatedSendBandwidth(
tbChannel.videoChannel,
&estimated_bandwidth));
EXPECT_GT(estimated_bandwidth, 0u);
EXPECT_EQ(0, ViE.rtp_rtcp->GetEstimatedReceiveBandwidth(
tbChannel.videoChannel,
&estimated_bandwidth));
EXPECT_GT(estimated_bandwidth, 0u);

View File

@ -1054,6 +1054,11 @@ void ViEChannel::GetBandwidthUsage(WebRtc_UWord32& total_bitrate_sent,
}
}
int ViEChannel::GetEstimatedReceiveBandwidth(
WebRtc_UWord32* estimated_bandwidth) const {
return rtp_rtcp_.EstimatedReceiveBandwidth(estimated_bandwidth);
}
WebRtc_Word32 ViEChannel::SetKeepAliveStatus(
const bool enable,
const WebRtc_Word8 unknown_payload_type,

View File

@ -162,6 +162,7 @@ class ViEChannel
WebRtc_UWord32& video_bitrate_sent,
WebRtc_UWord32& fec_bitrate_sent,
WebRtc_UWord32& nackBitrateSent) const;
int GetEstimatedReceiveBandwidth(WebRtc_UWord32* estimated_bandwidth) const;
WebRtc_Word32 SetKeepAliveStatus(const bool enable,
const WebRtc_Word8 unknown_payload_type,
const WebRtc_UWord16 delta_transmit_timeMS);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -459,6 +459,26 @@ int ViECodecImpl::GetReceiveCodecStastistics(const int video_channel,
return 0;
}
int ViECodecImpl::GetCodecTargetBitrate(const int video_channel,
unsigned int* bitrate) const {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s(video_channel: %d, codec_type: %d)", __FUNCTION__,
video_channel);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
if (!vie_encoder) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s: No send codec for channel %d", __FUNCTION__,
video_channel);
shared_data_->SetLastError(kViECodecInvalidChannelId);
return -1;
}
return vie_encoder->CodecTargetBitrate(static_cast<WebRtc_UWord32*>(bitrate));
}
unsigned int ViECodecImpl::GetDiscardedPackets(const int video_channel) const {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -49,6 +49,8 @@ class ViECodecImpl
virtual int GetReceiveCodecStastistics(const int video_channel,
unsigned int& key_frames,
unsigned int& delta_frames) const;
virtual int GetCodecTargetBitrate(const int video_channel,
unsigned int* bitrate) const;
virtual unsigned int GetDiscardedPackets(const int video_channel) const;
virtual int SetKeyFrameRequestCallbackStatus(const int video_channel,
const bool enable);

View File

@ -26,13 +26,15 @@
namespace webrtc {
class QMTestVideoSettingsCallback : public VCMQMSettingsCallback {
class QMVideoSettingsCallback : public VCMQMSettingsCallback {
public:
QMTestVideoSettingsCallback(VideoProcessingModule* vpm,
QMVideoSettingsCallback(WebRtc_Word32 engine_id,
WebRtc_Word32 channel_id,
VideoProcessingModule* vpm,
VideoCodingModule* vcm,
WebRtc_Word32 num_of_cores,
WebRtc_Word32 max_payload_length);
~QMTestVideoSettingsCallback();
~QMVideoSettingsCallback();
// Update VPM with QM (quality modes: frame size & frame rate) settings.
WebRtc_Word32 SetVideoQMSettings(const WebRtc_UWord32 frame_rate,
@ -42,6 +44,8 @@ class QMTestVideoSettingsCallback : public VCMQMSettingsCallback {
void SetMaxPayloadLength(WebRtc_Word32 max_payload_length);
private:
WebRtc_Word32 engine_id_;
WebRtc_Word32 channel_id_;
VideoProcessingModule* vpm_;
VideoCodingModule* vcm_;
WebRtc_Word32 num_cores_;
@ -100,8 +104,13 @@ ViEEncoder::ViEEncoder(WebRtc_Word32 engine_id, WebRtc_Word32 channel_id,
default_rtp_rtcp_.RegisterIncomingRTCPCallback(this);
module_process_thread_.RegisterModule(&default_rtp_rtcp_);
qm_callback_ = new QMTestVideoSettingsCallback(
&vpm_, &vcm_, number_of_cores, default_rtp_rtcp_.MaxDataPayloadLength());
qm_callback_ = new QMVideoSettingsCallback(
engine_id_,
channel_id_,
&vpm_,
&vcm_,
number_of_cores,
default_rtp_rtcp_.MaxDataPayloadLength());
#ifdef VIDEOCODEC_VP8
VideoCodec video_codec;
@ -240,7 +249,11 @@ WebRtc_Word32 ViEEncoder::DeRegisterExternalEncoder(WebRtc_UWord8 pl_type) {
webrtc::VideoCodec current_send_codec;
if (vcm_.SendCodec(&current_send_codec) == VCM_OK) {
current_send_codec.startBitrate = vcm_.Bitrate();
if (vcm_.Bitrate(&current_send_codec.startBitrate) != 0) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo,
ViEId(engine_id_, channel_id_),
"Failed to get the current encoder target bitrate.");
}
}
if (vcm_.RegisterExternalEncoder(NULL, pl_type) != VCM_OK) {
@ -560,11 +573,19 @@ WebRtc_Word32 ViEEncoder::SendCodecStatistics(
return 0;
}
WebRtc_Word32 ViEEncoder::EstimatedBandwidth(
WebRtc_Word32 ViEEncoder::EstimatedSendBandwidth(
WebRtc_UWord32* available_bandwidth) const {
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
__FUNCTION__);
return default_rtp_rtcp_.EstimatedBandwidth(available_bandwidth);
return default_rtp_rtcp_.EstimatedSendBandwidth(available_bandwidth);
}
int ViEEncoder::CodecTargetBitrate(WebRtc_UWord32* bitrate) const {
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
__FUNCTION__);
if (vcm_.Bitrate(bitrate) != 0)
return -1;
return 0;
}
WebRtc_Word32 ViEEncoder::UpdateProtectionMethod() {
@ -607,7 +628,11 @@ WebRtc_Word32 ViEEncoder::UpdateProtectionMethod() {
webrtc::VideoCodec codec;
if (vcm_.SendCodec(&codec) == 0) {
WebRtc_UWord16 max_pay_load = default_rtp_rtcp_.MaxDataPayloadLength();
codec.startBitrate = vcm_.Bitrate();
if (vcm_.Bitrate(&codec.startBitrate) != 0) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo,
ViEId(engine_id_, channel_id_),
"Failed to get the current encoder target bitrate.");
}
if (vcm_.RegisterSendCodec(&codec, number_of_cores_, max_pay_load) != 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
ViEId(engine_id_, channel_id_),
@ -805,21 +830,25 @@ ViEFileRecorder& ViEEncoder::GetOutgoingFileRecorder() {
return file_recorder_;
}
QMTestVideoSettingsCallback::QMTestVideoSettingsCallback(
QMVideoSettingsCallback::QMVideoSettingsCallback(
WebRtc_Word32 engine_id,
WebRtc_Word32 channel_id,
VideoProcessingModule* vpm,
VideoCodingModule* vcm,
WebRtc_Word32 num_cores,
WebRtc_Word32 max_payload_length)
: vpm_(vpm),
: engine_id_(engine_id),
channel_id_(channel_id),
vpm_(vpm),
vcm_(vcm),
num_cores_(num_cores),
max_payload_length_(max_payload_length) {
}
QMTestVideoSettingsCallback::~QMTestVideoSettingsCallback() {
QMVideoSettingsCallback::~QMVideoSettingsCallback() {
}
WebRtc_Word32 QMTestVideoSettingsCallback::SetVideoQMSettings(
WebRtc_Word32 QMVideoSettingsCallback::SetVideoQMSettings(
const WebRtc_UWord32 frame_rate,
const WebRtc_UWord32 width,
const WebRtc_UWord32 height) {
@ -830,9 +859,14 @@ WebRtc_Word32 QMTestVideoSettingsCallback::SetVideoQMSettings(
// Get current settings.
VideoCodec current_codec;
vcm_->SendCodec(&current_codec);
WebRtc_UWord32 current_bit_rate = vcm_->Bitrate();
WebRtc_UWord32 current_bit_rate;
if (vcm_->Bitrate(&current_bit_rate) != 0) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo,
ViEId(engine_id_, channel_id_),
"Failed to get the current encoder target bitrate.");
}
// Set the new calues.
// Set the new values.
current_codec.height = static_cast<WebRtc_UWord16>(height);
current_codec.width = static_cast<WebRtc_UWord16>(width);
current_codec.maxFramerate = static_cast<WebRtc_UWord8>(frame_rate);
@ -845,7 +879,7 @@ WebRtc_Word32 QMTestVideoSettingsCallback::SetVideoQMSettings(
return ret_val;
}
void QMTestVideoSettingsCallback::SetMaxPayloadLength(
void QMVideoSettingsCallback::SetMaxPayloadLength(
WebRtc_Word32 max_payload_length) {
max_payload_length_ = max_payload_length;
}

View File

@ -25,7 +25,7 @@ namespace webrtc {
class CriticalSectionWrapper;
class ProcessThread;
class QMTestVideoSettingsCallback;
class QMVideoSettingsCallback;
class RtpRtcp;
class VideoCodingModule;
class ViEEffectFilter;
@ -88,7 +88,9 @@ class ViEEncoder
WebRtc_Word32 SendKeyFrame();
WebRtc_Word32 SendCodecStatistics(WebRtc_UWord32& num_key_frames,
WebRtc_UWord32& num_delta_frames);
WebRtc_Word32 EstimatedBandwidth(WebRtc_UWord32* available_bandwidth) const;
WebRtc_Word32 EstimatedSendBandwidth(
WebRtc_UWord32* available_bandwidth) const;
int CodecTargetBitrate(WebRtc_UWord32* bitrate) const;
// Loss protection.
WebRtc_Word32 UpdateProtectionMethod();
@ -172,7 +174,7 @@ class ViEEncoder
ViEFileRecorder file_recorder_;
// Quality modes callback
QMTestVideoSettingsCallback* qm_callback_;
QMVideoSettingsCallback* qm_callback_;
};
} // namespace webrtc

View File

@ -727,7 +727,7 @@ int ViERTP_RTCPImpl::GetBandwidthUsage(const int video_channel,
return 0;
}
int ViERTP_RTCPImpl::GetEstimatedBandwidth(
int ViERTP_RTCPImpl::GetEstimatedSendBandwidth(
const int video_channel,
unsigned int* estimated_bandwidth) const {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
@ -743,7 +743,27 @@ int ViERTP_RTCPImpl::GetEstimatedBandwidth(
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
return -1;
}
return vie_encoder->EstimatedBandwidth(
return vie_encoder->EstimatedSendBandwidth(
static_cast<WebRtc_UWord32*>(estimated_bandwidth));
}
int ViERTP_RTCPImpl::GetEstimatedReceiveBandwidth(
const int video_channel,
unsigned int* estimated_bandwidth) const {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d)", __FUNCTION__, video_channel);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s: Could not get channel %d", __FUNCTION__,
video_channel);
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
return -1;
}
return vie_channel->GetEstimatedReceiveBandwidth(
static_cast<WebRtc_UWord32*>(estimated_bandwidth));
}

View File

@ -87,7 +87,10 @@ class ViERTP_RTCPImpl
unsigned int& video_bitrate_sent,
unsigned int& fec_bitrate_sent,
unsigned int& nackBitrateSent) const;
virtual int GetEstimatedBandwidth(
virtual int GetEstimatedSendBandwidth(
const int video_channel,
unsigned int* estimated_bandwidth) const;
virtual int GetEstimatedReceiveBandwidth(
const int video_channel,
unsigned int* estimated_bandwidth) const;
virtual int SetRTPKeepAliveStatus(