Added protobuf message for loss-based BWE events, and wired it up to the send side bandwidth estimator.

BUG=

Review URL: https://codereview.webrtc.org/1411673003

Cr-Commit-Position: refs/heads/master@{#10531}
This commit is contained in:
terelius
2015-11-05 12:02:15 -08:00
committed by Commit bot
parent 962c5ce7e8
commit 006d93d3c6
10 changed files with 154 additions and 40 deletions

View File

@ -129,6 +129,11 @@ void BitrateControllerImpl::SetReservedBitrate(uint32_t reserved_bitrate_bps) {
MaybeTriggerOnNetworkChanged();
}
void BitrateControllerImpl::SetEventLog(RtcEventLog* event_log) {
rtc::CritScope cs(&critsect_);
bandwidth_estimation_.SetEventLog(event_log);
}
void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) {
{
rtc::CritScope cs(&critsect_);

View File

@ -41,6 +41,8 @@ class BitrateControllerImpl : public BitrateController {
void SetReservedBitrate(uint32_t reserved_bitrate_bps) override;
void SetEventLog(RtcEventLog* event_log) override;
int64_t TimeUntilNextProcess() override;
int32_t Process() override;

View File

@ -23,6 +23,7 @@
namespace webrtc {
class CriticalSectionWrapper;
class RtcEventLog;
struct PacketInfo;
class BitrateObserver {
@ -56,6 +57,8 @@ class BitrateController : public Module {
virtual void SetStartBitrate(int start_bitrate_bps) = 0;
virtual void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) = 0;
virtual void SetEventLog(RtcEventLog* event_log) = 0;
// Gets the available payload bandwidth in bits per second. Note that
// this bandwidth excludes packet headers.
virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0;

View File

@ -16,6 +16,7 @@
#include "webrtc/system_wrappers/include/field_trial.h"
#include "webrtc/system_wrappers/include/logging.h"
#include "webrtc/system_wrappers/include/metrics.h"
#include "webrtc/call/rtc_event_log.h"
namespace webrtc {
namespace {
@ -59,7 +60,8 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation()
initially_lost_packets_(0),
bitrate_at_2_seconds_kbps_(0),
uma_update_state_(kNoUpdate),
rampup_uma_stats_updated_(kNumUmaRampupMetrics, false) {}
rampup_uma_stats_updated_(kNumUmaRampupMetrics, false),
event_log_(nullptr) {}
SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {}
@ -206,6 +208,11 @@ void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) {
// rates).
bitrate_ += 1000;
if (event_log_) {
event_log_->LogBwePacketLossEvent(
bitrate_, last_fraction_loss_,
expected_packets_since_last_loss_update_);
}
} else if (last_fraction_loss_ <= 26) {
// Loss between 2% - 10%: Do nothing.
} else {
@ -224,6 +231,11 @@ void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) {
512.0);
has_decreased_since_last_fraction_loss_ = true;
}
if (event_log_) {
event_log_->LogBwePacketLossEvent(
bitrate_, last_fraction_loss_,
expected_packets_since_last_loss_update_);
}
}
}
bitrate_ = CapBitrateToThresholds(now_ms, bitrate_);
@ -274,4 +286,9 @@ uint32_t SendSideBandwidthEstimation::CapBitrateToThresholds(
}
return bitrate;
}
void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) {
event_log_ = event_log;
}
} // namespace webrtc

View File

@ -19,6 +19,9 @@
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
namespace webrtc {
class RtcEventLog;
class SendSideBandwidthEstimation {
public:
SendSideBandwidthEstimation();
@ -42,6 +45,8 @@ class SendSideBandwidthEstimation {
void SetMinMaxBitrate(int min_bitrate, int max_bitrate);
int GetMinBitrate() const;
void SetEventLog(RtcEventLog* event_log);
private:
enum UmaState { kNoUpdate, kFirstDone, kDone };
@ -81,6 +86,7 @@ class SendSideBandwidthEstimation {
int bitrate_at_2_seconds_kbps_;
UmaState uma_update_state_;
std::vector<bool> rampup_uma_stats_updated_;
RtcEventLog* event_log_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_