Fix BWE simulations so that it uses the delay based BWE.

Rename kFullSendSideEstimator -> kSendSideEstimator and add new class SendSideBweSender (controlled by kSendSideEstimator) that actually uses the send side BWE.

Move the mock to logging/rtc_event_log/mock.
Allow congestion_controller, remote_bitrate_estimator and audio to depend on loggging/rtc_event_log

BUG=webrtc:6526
NOPRESUBMIT=True

Review-Url: https://codereview.webrtc.org/2431093003
Cr-Commit-Position: refs/heads/master@{#14772}
This commit is contained in:
terelius 2016-10-25 07:04:37 -07:00 committed by Commit bot
parent 1836fd6257
commit 2d81eb33f5
17 changed files with 56 additions and 65 deletions

View File

@ -3,6 +3,7 @@ include_rules = [
"+webrtc/voice_engine",
"+webrtc/modules/audio_coding/codecs/mock",
"+webrtc/call",
"+webrtc/logging/rtc_event_log",
"+webrtc/modules/bitrate_controller",
"+webrtc/modules/congestion_controller",
"+webrtc/modules/pacing",
@ -11,12 +12,3 @@ include_rules = [
"+webrtc/system_wrappers",
"+webrtc/voice_engine",
]
specific_include_rules = {
"audio_receive_stream_unittest\.cc": [
"+webrtc/call/mock",
],
"audio_send_stream_unittest\.cc": [
"+webrtc/call/mock",
],
}

View File

@ -13,7 +13,7 @@
#include "webrtc/audio/audio_receive_stream.h"
#include "webrtc/audio/conversion.h"
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h"
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"

View File

@ -15,7 +15,7 @@
#include "webrtc/audio/audio_state.h"
#include "webrtc/audio/conversion.h"
#include "webrtc/base/task_queue.h"
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
#include "webrtc/modules/pacing/paced_sender.h"

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_CALL_MOCK_MOCK_RTC_EVENT_LOG_H_
#define WEBRTC_CALL_MOCK_MOCK_RTC_EVENT_LOG_H_
#ifndef WEBRTC_LOGGING_RTC_EVENT_LOG_MOCK_MOCK_RTC_EVENT_LOG_H_
#define WEBRTC_LOGGING_RTC_EVENT_LOG_MOCK_MOCK_RTC_EVENT_LOG_H_
#include <string>
@ -62,4 +62,4 @@ class MockRtcEventLog : public RtcEventLog {
} // namespace webrtc
#endif // WEBRTC_CALL_MOCK_MOCK_RTC_EVENT_LOG_H_
#endif // WEBRTC_LOGGING_RTC_EVENT_LOG_MOCK_MOCK_RTC_EVENT_LOG_H_

View File

@ -11,7 +11,7 @@
#include <algorithm>
#include <vector>
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/logging/rtc_event_log/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"

View File

@ -11,7 +11,7 @@
#include <algorithm>
#include <vector>
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h"
#include "webrtc/test/gtest.h"

View File

@ -1,6 +1,6 @@
include_rules = [
"+webrtc/base",
"+webrtc/call/mock",
"+webrtc/logging/rtc_event_log",
"+webrtc/system_wrappers",
"+webrtc/video",
]

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"

View File

@ -1,5 +1,6 @@
include_rules = [
"+webrtc/base",
"+webrtc/logging/rtc_event_log",
"+webrtc/system_wrappers",
]
@ -7,10 +8,4 @@ specific_include_rules = {
"nada\.h": [
"+webrtc/voice_engine",
],
"remb\.h": [
"+webrtc/call/mock",
],
"send_side\.h": [
"+webrtc/call/mock",
],
}

View File

@ -47,7 +47,7 @@ class BweSimulation : public BweTest,
INSTANTIATE_TEST_CASE_P(VideoSendersTest,
BweSimulation,
::testing::Values(kRembEstimator,
kFullSendSideEstimator,
kSendSideEstimator,
kNadaEstimator));
TEST_P(BweSimulation, SprintUplinkTest) {
@ -332,7 +332,7 @@ TEST_P(BweSimulation, TcpFairness1000msTest) {
RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 1000, 50, 0, offset_ms);
}
// The following test cases begin with "Evaluation" as a referrence to the
// The following test cases begin with "Evaluation" as a reference to the
// Internet draft https://tools.ietf.org/html/draft-ietf-rmcat-eval-test-01.
TEST_P(BweSimulation, Evaluation1) {
@ -380,20 +380,20 @@ TEST_P(BweSimulation, Evaluation8) {
TEST_P(BweSimulation, GccComparison1) {
RunVariableCapacity1SingleFlow(GetParam());
BweTest gcc_test(false);
gcc_test.RunVariableCapacity1SingleFlow(kFullSendSideEstimator);
gcc_test.RunVariableCapacity1SingleFlow(kSendSideEstimator);
}
TEST_P(BweSimulation, GccComparison2) {
const size_t kNumFlows = 2;
RunVariableCapacity2MultipleFlows(GetParam(), kNumFlows);
BweTest gcc_test(false);
gcc_test.RunVariableCapacity2MultipleFlows(kFullSendSideEstimator, kNumFlows);
gcc_test.RunVariableCapacity2MultipleFlows(kSendSideEstimator, kNumFlows);
}
TEST_P(BweSimulation, GccComparison3) {
RunBidirectionalFlow(GetParam());
BweTest gcc_test(false);
gcc_test.RunBidirectionalFlow(kFullSendSideEstimator);
gcc_test.RunBidirectionalFlow(kSendSideEstimator);
}
TEST_P(BweSimulation, GccComparison4) {
@ -405,13 +405,13 @@ TEST_P(BweSimulation, GccComparison4) {
TEST_P(BweSimulation, GccComparison5) {
RunRoundTripTimeFairness(GetParam());
BweTest gcc_test(false);
gcc_test.RunRoundTripTimeFairness(kFullSendSideEstimator);
gcc_test.RunRoundTripTimeFairness(kSendSideEstimator);
}
TEST_P(BweSimulation, GccComparison6) {
RunLongTcpFairness(GetParam());
BweTest gcc_test(false);
gcc_test.RunLongTcpFairness(kFullSendSideEstimator);
gcc_test.RunLongTcpFairness(kSendSideEstimator);
}
TEST_P(BweSimulation, GccComparison7) {
@ -426,14 +426,14 @@ TEST_P(BweSimulation, GccComparison7) {
tcp_starting_times_ms);
BweTest gcc_test(false);
gcc_test.RunMultipleShortTcpFairness(
kFullSendSideEstimator, tcp_file_sizes_bytes, tcp_starting_times_ms);
gcc_test.RunMultipleShortTcpFairness(kSendSideEstimator, tcp_file_sizes_bytes,
tcp_starting_times_ms);
}
TEST_P(BweSimulation, GccComparison8) {
RunPauseResumeFlows(GetParam());
BweTest gcc_test(false);
gcc_test.RunPauseResumeFlows(kFullSendSideEstimator);
gcc_test.RunPauseResumeFlows(kSendSideEstimator);
}
TEST_P(BweSimulation, GccComparisonChoke) {
@ -442,7 +442,7 @@ TEST_P(BweSimulation, GccComparisonChoke) {
RunChoke(GetParam(), capacities_kbps);
BweTest gcc_test(false);
gcc_test.RunChoke(kFullSendSideEstimator, capacities_kbps);
gcc_test.RunChoke(kSendSideEstimator, capacities_kbps);
}
} // namespace bwe

View File

@ -57,8 +57,7 @@ class BweFeedbackTest
INSTANTIATE_TEST_CASE_P(VideoSendersTest,
BweFeedbackTest,
::testing::Values(kRembEstimator,
kFullSendSideEstimator));
::testing::Values(kRembEstimator, kSendSideEstimator));
TEST_P(BweFeedbackTest, ConstantCapacity) {
AdaptiveVideoSource source(0, 30, 300, 0, 0);

View File

@ -90,8 +90,8 @@ BweSender* CreateBweSender(BandwidthEstimatorType estimator,
switch (estimator) {
case kRembEstimator:
return new RembBweSender(kbps, observer, clock);
case kFullSendSideEstimator:
return new FullBweSender(kbps, observer, clock);
case kSendSideEstimator:
return new SendSideBweSender(kbps, observer, clock);
case kNadaEstimator:
return new NadaBweSender(kbps, observer, clock);
case kTcpEstimator:
@ -109,7 +109,7 @@ BweReceiver* CreateBweReceiver(BandwidthEstimatorType type,
switch (type) {
case kRembEstimator:
return new RembReceiver(flow_id, plot);
case kFullSendSideEstimator:
case kSendSideEstimator:
return new SendSideBweReceiver(flow_id);
case kNadaEstimator:
return new NadaBweReceiver(flow_id);

View File

@ -176,7 +176,7 @@ enum BandwidthEstimatorType {
kNullEstimator,
kNadaEstimator,
kRembEstimator,
kFullSendSideEstimator,
kSendSideEstimator,
kTcpEstimator
};

View File

@ -16,7 +16,7 @@
#include <vector>
#include "webrtc/base/constructormagic.h"
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe.h"
namespace webrtc {

View File

@ -13,7 +13,7 @@
#include <algorithm>
#include "webrtc/base/logging.h"
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h"
#include "webrtc/modules/congestion_controller/delay_based_bwe.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
namespace webrtc {
@ -22,12 +22,14 @@ namespace bwe {
const int kFeedbackIntervalMs = 50;
FullBweSender::FullBweSender(int kbps, BitrateObserver* observer, Clock* clock)
SendSideBweSender::SendSideBweSender(int kbps,
BitrateObserver* observer,
Clock* clock)
: bitrate_controller_(
BitrateController::CreateBitrateController(clock,
observer,
&event_log_)),
rbe_(new RemoteBitrateEstimatorAbsSendTime(this, clock)),
bwe_(new DelayBasedBwe(clock)),
feedback_observer_(bitrate_controller_->CreateRtcpBandwidthObserver()),
clock_(clock),
send_time_history_(clock_, 10000),
@ -39,17 +41,16 @@ FullBweSender::FullBweSender(int kbps, BitrateObserver* observer, Clock* clock)
bitrate_controller_->SetStartBitrate(1000 * kbps);
bitrate_controller_->SetMinMaxBitrate(1000 * kMinBitrateKbps,
1000 * kMaxBitrateKbps);
rbe_->SetMinBitrate(1000 * kMinBitrateKbps);
bwe_->SetMinBitrate(1000 * kMinBitrateKbps);
}
FullBweSender::~FullBweSender() {
}
SendSideBweSender::~SendSideBweSender() {}
int FullBweSender::GetFeedbackIntervalMs() const {
int SendSideBweSender::GetFeedbackIntervalMs() const {
return kFeedbackIntervalMs;
}
void FullBweSender::GiveFeedback(const FeedbackPacket& feedback) {
void SendSideBweSender::GiveFeedback(const FeedbackPacket& feedback) {
const SendSideBweFeedback& fb =
static_cast<const SendSideBweFeedback&>(feedback);
if (fb.packet_feedback_vector().empty())
@ -67,10 +68,14 @@ void FullBweSender::GiveFeedback(const FeedbackPacket& feedback) {
int64_t rtt_ms =
clock_->TimeInMilliseconds() - feedback.latest_send_time_ms();
rbe_->OnRttUpdate(rtt_ms, rtt_ms);
bwe_->OnRttUpdate(rtt_ms, rtt_ms);
BWE_TEST_LOGGING_PLOT(1, "RTT", clock_->TimeInMilliseconds(), rtt_ms);
rbe_->IncomingPacketFeedbackVector(packet_feedback_vector);
DelayBasedBwe::Result result =
bwe_->IncomingPacketFeedbackVector(packet_feedback_vector);
if (result.updated)
bitrate_controller_->OnDelayBasedBweResult(result);
if (has_received_ack_) {
int expected_packets = fb.packet_feedback_vector().back().sequence_number -
last_acked_seq_num_;
@ -99,7 +104,7 @@ void FullBweSender::GiveFeedback(const FeedbackPacket& feedback) {
}
}
void FullBweSender::OnPacketsSent(const Packets& packets) {
void SendSideBweSender::OnPacketsSent(const Packets& packets) {
for (Packet* packet : packets) {
if (packet->GetPacketType() == Packet::kMedia) {
MediaPacket* media_packet = static_cast<MediaPacket*>(packet);
@ -114,17 +119,17 @@ void FullBweSender::OnPacketsSent(const Packets& packets) {
}
}
void FullBweSender::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs,
uint32_t bitrate) {
void SendSideBweSender::OnReceiveBitrateChanged(
const std::vector<uint32_t>& ssrcs,
uint32_t bitrate) {
feedback_observer_->OnReceivedEstimatedBitrate(bitrate);
}
int64_t FullBweSender::TimeUntilNextProcess() {
int64_t SendSideBweSender::TimeUntilNextProcess() {
return bitrate_controller_->TimeUntilNextProcess();
}
void FullBweSender::Process() {
rbe_->Process();
void SendSideBweSender::Process() {
bitrate_controller_->Process();
}

View File

@ -14,7 +14,7 @@
#include <memory>
#include <vector>
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe.h"
@ -22,10 +22,10 @@ namespace webrtc {
namespace testing {
namespace bwe {
class FullBweSender : public BweSender, public RemoteBitrateObserver {
class SendSideBweSender : public BweSender, public RemoteBitrateObserver {
public:
FullBweSender(int kbps, BitrateObserver* observer, Clock* clock);
virtual ~FullBweSender();
SendSideBweSender(int kbps, BitrateObserver* observer, Clock* clock);
virtual ~SendSideBweSender();
int GetFeedbackIntervalMs() const override;
void GiveFeedback(const FeedbackPacket& feedback) override;
@ -37,7 +37,7 @@ class FullBweSender : public BweSender, public RemoteBitrateObserver {
protected:
std::unique_ptr<BitrateController> bitrate_controller_;
std::unique_ptr<RemoteBitrateEstimator> rbe_;
std::unique_ptr<DelayBasedBwe> bwe_;
std::unique_ptr<RtcpBandwidthObserver> feedback_observer_;
private:
@ -50,7 +50,7 @@ class FullBweSender : public BweSender, public RemoteBitrateObserver {
SequenceNumberUnwrapper seq_num_unwrapper_;
::testing::NiceMock<MockRtcEventLog> event_log_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FullBweSender);
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SendSideBweSender);
};
class SendSideBweReceiver : public BweReceiver {

View File

@ -13,7 +13,7 @@
#include "webrtc/base/buffer.h"
#include "webrtc/base/rate_limiter.h"
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"