Revert of Move RtcEventLog object from inside VoiceEngine to Call. (patchset #16 id:420001 of https://codereview.webrtc.org/1748403002/ )
Reason for revert: Reverting all CLs related to moving the eventlog, as they break Chromium tests. Original issue's description: > Move RtcEventLog object from inside VoiceEngine to Call. > > In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced. > The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface. > > BUG=webrtc:4741,webrtc:5603,chromium:609749 > R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org > > Committed: https://crrev.com/1895526c6130e3d0e9b154f95079b8eda7567016 > Cr-Commit-Position: refs/heads/master@{#13321} TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:4741,webrtc:5603,chromium:609749 Review-Url: https://codereview.webrtc.org/2111813002 Cr-Commit-Position: refs/heads/master@{#13340}
This commit is contained in:
@ -79,25 +79,20 @@ class BitrateControllerImpl::RtcpBandwidthObserverImpl
|
||||
|
||||
BitrateController* BitrateController::CreateBitrateController(
|
||||
Clock* clock,
|
||||
BitrateObserver* observer,
|
||||
RtcEventLog* event_log) {
|
||||
return new BitrateControllerImpl(clock, observer, event_log);
|
||||
BitrateObserver* observer) {
|
||||
return new BitrateControllerImpl(clock, observer);
|
||||
}
|
||||
|
||||
BitrateController* BitrateController::CreateBitrateController(
|
||||
Clock* clock,
|
||||
RtcEventLog* event_log) {
|
||||
return CreateBitrateController(clock, nullptr, event_log);
|
||||
BitrateController* BitrateController::CreateBitrateController(Clock* clock) {
|
||||
return new BitrateControllerImpl(clock, nullptr);
|
||||
}
|
||||
|
||||
BitrateControllerImpl::BitrateControllerImpl(Clock* clock,
|
||||
BitrateObserver* observer,
|
||||
RtcEventLog* event_log)
|
||||
BitrateObserver* observer)
|
||||
: clock_(clock),
|
||||
observer_(observer),
|
||||
last_bitrate_update_ms_(clock_->TimeInMilliseconds()),
|
||||
event_log_(event_log),
|
||||
bandwidth_estimation_(event_log),
|
||||
bandwidth_estimation_(),
|
||||
reserved_bitrate_bps_(0),
|
||||
last_bitrate_bps_(0),
|
||||
last_fraction_loss_(0),
|
||||
@ -148,7 +143,7 @@ void BitrateControllerImpl::ResetBitrates(int bitrate_bps,
|
||||
int max_bitrate_bps) {
|
||||
{
|
||||
rtc::CritScope cs(&critsect_);
|
||||
bandwidth_estimation_ = SendSideBandwidthEstimation(event_log_);
|
||||
bandwidth_estimation_ = SendSideBandwidthEstimation();
|
||||
bandwidth_estimation_.SetBitrates(bitrate_bps, min_bitrate_bps,
|
||||
max_bitrate_bps);
|
||||
}
|
||||
@ -163,6 +158,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_);
|
||||
|
||||
@ -30,9 +30,7 @@ class BitrateControllerImpl : public BitrateController {
|
||||
public:
|
||||
// TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC.
|
||||
// |observer| is left for project that is not yet updated.
|
||||
BitrateControllerImpl(Clock* clock,
|
||||
BitrateObserver* observer,
|
||||
RtcEventLog* event_log);
|
||||
BitrateControllerImpl(Clock* clock, BitrateObserver* observer);
|
||||
virtual ~BitrateControllerImpl() {}
|
||||
|
||||
bool AvailableBandwidth(uint32_t* bandwidth) const override;
|
||||
@ -56,6 +54,8 @@ class BitrateControllerImpl : public BitrateController {
|
||||
|
||||
void SetReservedBitrate(uint32_t reserved_bitrate_bps) override;
|
||||
|
||||
void SetEventLog(RtcEventLog* event_log) override;
|
||||
|
||||
// Returns true if the parameters have changed since the last call.
|
||||
bool GetNetworkParameters(uint32_t* bitrate,
|
||||
uint8_t* fraction_loss,
|
||||
@ -86,7 +86,6 @@ class BitrateControllerImpl : public BitrateController {
|
||||
Clock* const clock_;
|
||||
BitrateObserver* const observer_;
|
||||
int64_t last_bitrate_update_ms_;
|
||||
RtcEventLog* const event_log_;
|
||||
|
||||
rtc::CriticalSection critsect_;
|
||||
SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(critsect_);
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
#include "webrtc/call/mock/mock_rtc_event_log.h"
|
||||
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
|
||||
#include "webrtc/modules/pacing/mock/mock_paced_sender.h"
|
||||
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
@ -67,8 +66,8 @@ class BitrateControllerTest : public ::testing::Test {
|
||||
~BitrateControllerTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
controller_ = BitrateController::CreateBitrateController(
|
||||
&clock_, &bitrate_observer_, &event_log_);
|
||||
controller_ =
|
||||
BitrateController::CreateBitrateController(&clock_, &bitrate_observer_);
|
||||
controller_->SetStartBitrate(kStartBitrateBps);
|
||||
EXPECT_EQ(kStartBitrateBps, bitrate_observer_.last_bitrate_);
|
||||
controller_->SetMinMaxBitrate(kMinBitrateBps, kMaxBitrateBps);
|
||||
@ -92,7 +91,6 @@ class BitrateControllerTest : public ::testing::Test {
|
||||
TestBitrateObserver bitrate_observer_;
|
||||
BitrateController* controller_;
|
||||
RtcpBandwidthObserver* bandwidth_observer_;
|
||||
webrtc::MockRtcEventLog event_log_;
|
||||
};
|
||||
|
||||
TEST_F(BitrateControllerTest, DefaultMinMaxBitrate) {
|
||||
@ -109,7 +107,6 @@ TEST_F(BitrateControllerTest, DefaultMinMaxBitrate) {
|
||||
|
||||
TEST_F(BitrateControllerTest, OneBitrateObserverOneRtcpObserver) {
|
||||
// First REMB applies immediately.
|
||||
EXPECT_CALL(event_log_, LogBwePacketLossEvent(testing::Gt(0), 0, 0)).Times(8);
|
||||
int64_t time_ms = 1001;
|
||||
webrtc::ReportBlockList report_blocks;
|
||||
report_blocks.push_back(CreateReportBlock(1, 2, 0, 1));
|
||||
@ -186,7 +183,6 @@ TEST_F(BitrateControllerTest, OneBitrateObserverOneRtcpObserver) {
|
||||
|
||||
TEST_F(BitrateControllerTest, OneBitrateObserverTwoRtcpObservers) {
|
||||
// REMBs during the first 2 seconds apply immediately.
|
||||
EXPECT_CALL(event_log_, LogBwePacketLossEvent(testing::Gt(0), 0, 0)).Times(9);
|
||||
int64_t time_ms = 1;
|
||||
webrtc::ReportBlockList report_blocks;
|
||||
report_blocks.push_back(CreateReportBlock(1, 2, 0, 1));
|
||||
@ -282,13 +278,6 @@ TEST_F(BitrateControllerTest, OneBitrateObserverTwoRtcpObservers) {
|
||||
}
|
||||
|
||||
TEST_F(BitrateControllerTest, OneBitrateObserverMultipleReportBlocks) {
|
||||
testing::Expectation first_calls =
|
||||
EXPECT_CALL(event_log_, LogBwePacketLossEvent(testing::Gt(0), 0, 0))
|
||||
.Times(7);
|
||||
EXPECT_CALL(event_log_,
|
||||
LogBwePacketLossEvent(testing::Gt(0), testing::Gt(0), 0))
|
||||
.Times(2)
|
||||
.After(first_calls);
|
||||
uint32_t sequence_number[2] = {0, 0xFF00};
|
||||
const int kStartBitrate = 200000;
|
||||
const int kMinBitrate = 100000;
|
||||
|
||||
@ -55,11 +55,8 @@ class BitrateController : public Module {
|
||||
// TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC.
|
||||
// Remove this method once other other projects does not use it.
|
||||
static BitrateController* CreateBitrateController(Clock* clock,
|
||||
BitrateObserver* observer,
|
||||
RtcEventLog* event_log);
|
||||
|
||||
static BitrateController* CreateBitrateController(Clock* clock,
|
||||
RtcEventLog* event_log);
|
||||
BitrateObserver* observer);
|
||||
static BitrateController* CreateBitrateController(Clock* clock);
|
||||
|
||||
virtual ~BitrateController() {}
|
||||
|
||||
@ -79,6 +76,8 @@ class BitrateController : public Module {
|
||||
|
||||
virtual void UpdateDelayBasedEstimate(uint32_t 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;
|
||||
|
||||
@ -44,7 +44,7 @@ const size_t kNumUmaRampupMetrics =
|
||||
|
||||
} // namespace
|
||||
|
||||
SendSideBandwidthEstimation::SendSideBandwidthEstimation(RtcEventLog* event_log)
|
||||
SendSideBandwidthEstimation::SendSideBandwidthEstimation()
|
||||
: lost_packets_since_last_loss_update_Q8_(0),
|
||||
expected_packets_since_last_loss_update_(0),
|
||||
bitrate_(0),
|
||||
@ -63,9 +63,7 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation(RtcEventLog* event_log)
|
||||
bitrate_at_2_seconds_kbps_(0),
|
||||
uma_update_state_(kNoUpdate),
|
||||
rampup_uma_stats_updated_(kNumUmaRampupMetrics, false),
|
||||
event_log_(event_log) {
|
||||
RTC_DCHECK(event_log);
|
||||
}
|
||||
event_log_(nullptr) {}
|
||||
|
||||
SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {}
|
||||
|
||||
@ -229,9 +227,11 @@ void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) {
|
||||
// rates).
|
||||
bitrate_ += 1000;
|
||||
|
||||
event_log_->LogBwePacketLossEvent(
|
||||
bitrate_, last_fraction_loss_,
|
||||
expected_packets_since_last_loss_update_);
|
||||
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 {
|
||||
@ -250,9 +250,11 @@ void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) {
|
||||
512.0);
|
||||
has_decreased_since_last_fraction_loss_ = true;
|
||||
}
|
||||
event_log_->LogBwePacketLossEvent(
|
||||
bitrate_, last_fraction_loss_,
|
||||
expected_packets_since_last_loss_update_);
|
||||
if (event_log_) {
|
||||
event_log_->LogBwePacketLossEvent(
|
||||
bitrate_, last_fraction_loss_,
|
||||
expected_packets_since_last_loss_update_);
|
||||
}
|
||||
}
|
||||
}
|
||||
bitrate_ = CapBitrateToThresholds(now_ms, bitrate_);
|
||||
@ -306,4 +308,9 @@ uint32_t SendSideBandwidthEstimation::CapBitrateToThresholds(
|
||||
}
|
||||
return bitrate;
|
||||
}
|
||||
|
||||
void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) {
|
||||
event_log_ = event_log;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -26,8 +26,7 @@ class RtcEventLog;
|
||||
|
||||
class SendSideBandwidthEstimation {
|
||||
public:
|
||||
SendSideBandwidthEstimation() = delete;
|
||||
explicit SendSideBandwidthEstimation(RtcEventLog* event_log);
|
||||
SendSideBandwidthEstimation();
|
||||
virtual ~SendSideBandwidthEstimation();
|
||||
|
||||
void CurrentEstimate(int* bitrate, uint8_t* loss, int64_t* rtt) const;
|
||||
@ -54,6 +53,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 };
|
||||
|
||||
|
||||
@ -12,14 +12,12 @@
|
||||
#include <vector>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/call/mock/mock_rtc_event_log.h"
|
||||
#include "webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
void TestProbing(bool use_delay_based) {
|
||||
MockRtcEventLog event_log;
|
||||
SendSideBandwidthEstimation bwe(&event_log);
|
||||
SendSideBandwidthEstimation bwe;
|
||||
bwe.SetMinMaxBitrate(100000, 1500000);
|
||||
bwe.SetSendBitrate(200000);
|
||||
|
||||
@ -64,11 +62,7 @@ TEST(SendSideBweTest, InitialDelayBasedBweWithProbing) {
|
||||
}
|
||||
|
||||
TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) {
|
||||
MockRtcEventLog event_log;
|
||||
EXPECT_CALL(event_log,
|
||||
LogBwePacketLossEvent(testing::Gt(0), testing::Gt(0), 0))
|
||||
.Times(3);
|
||||
SendSideBandwidthEstimation bwe(&event_log);
|
||||
SendSideBandwidthEstimation bwe;
|
||||
static const int kMinBitrateBps = 100000;
|
||||
static const int kInitialBitrateBps = 1000000;
|
||||
bwe.SetMinMaxBitrate(kMinBitrateBps, 1500000);
|
||||
|
||||
Reference in New Issue
Block a user