Makes new congestion controller work with rtp sender tests.

Bug: webrtc:9586
Change-Id: Ifa12ef5d85b19395c62fc1001a107c4151927098
Reviewed-on: https://webrtc-review.googlesource.com/102160
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24871}
This commit is contained in:
Sebastian Jansson 2018-09-27 17:32:00 +02:00 committed by Commit Bot
parent 287cfdecab
commit dc8c981dcb
2 changed files with 30 additions and 5 deletions

View File

@ -137,7 +137,23 @@ class RtpVideoSenderTestFixture {
}; };
} // namespace } // namespace
TEST(RtpVideoSenderTest, SendOnOneModule) { class RtpVideoSenderTest : public ::testing::Test,
public ::testing::WithParamInterface<std::string> {
public:
RtpVideoSenderTest() : field_trial_(GetParam()) {}
private:
test::ScopedFieldTrials field_trial_;
};
INSTANTIATE_TEST_CASE_P(Default, RtpVideoSenderTest, ::testing::Values(""));
INSTANTIATE_TEST_CASE_P(
TaskQueueTrial,
RtpVideoSenderTest,
::testing::Values("WebRTC-TaskQueueCongestionControl/Enabled/"));
TEST_P(RtpVideoSenderTest, SendOnOneModule) {
uint8_t payload = 'a'; uint8_t payload = 'a';
EncodedImage encoded_image; EncodedImage encoded_image;
encoded_image.SetTimestamp(1); encoded_image.SetTimestamp(1);
@ -167,7 +183,7 @@ TEST(RtpVideoSenderTest, SendOnOneModule) {
test.router()->OnEncodedImage(encoded_image, nullptr, nullptr).error); test.router()->OnEncodedImage(encoded_image, nullptr, nullptr).error);
} }
TEST(RtpVideoSenderTest, SendSimulcastSetActive) { TEST_P(RtpVideoSenderTest, SendSimulcastSetActive) {
uint8_t payload = 'a'; uint8_t payload = 'a';
EncodedImage encoded_image_1; EncodedImage encoded_image_1;
encoded_image_1.SetTimestamp(1); encoded_image_1.SetTimestamp(1);
@ -211,7 +227,7 @@ TEST(RtpVideoSenderTest, SendSimulcastSetActive) {
// behavior of the payload router. First sets one module to active and checks // behavior of the payload router. First sets one module to active and checks
// that outgoing data can be sent on this module, and checks that no data can // that outgoing data can be sent on this module, and checks that no data can
// be sent if both modules are inactive. // be sent if both modules are inactive.
TEST(RtpVideoSenderTest, SendSimulcastSetActiveModules) { TEST_P(RtpVideoSenderTest, SendSimulcastSetActiveModules) {
uint8_t payload = 'a'; uint8_t payload = 'a';
EncodedImage encoded_image_1; EncodedImage encoded_image_1;
encoded_image_1.SetTimestamp(1); encoded_image_1.SetTimestamp(1);
@ -252,7 +268,7 @@ TEST(RtpVideoSenderTest, SendSimulcastSetActiveModules) {
.error); .error);
} }
TEST(RtpVideoSenderTest, CreateWithNoPreviousStates) { TEST_P(RtpVideoSenderTest, CreateWithNoPreviousStates) {
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {}); RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
test.router()->SetActive(true); test.router()->SetActive(true);
@ -263,7 +279,7 @@ TEST(RtpVideoSenderTest, CreateWithNoPreviousStates) {
EXPECT_NE(initial_states.find(kSsrc2), initial_states.end()); EXPECT_NE(initial_states.find(kSsrc2), initial_states.end());
} }
TEST(RtpVideoSenderTest, CreateWithPreviousStates) { TEST_P(RtpVideoSenderTest, CreateWithPreviousStates) {
const int64_t kState1SharedFrameId = 123; const int64_t kState1SharedFrameId = 123;
const int64_t kState2SharedFrameId = 234; const int64_t kState2SharedFrameId = 234;
RtpPayloadState state1; RtpPayloadState state1;

View File

@ -368,6 +368,15 @@ SendSideCongestionController::SendSideCongestionController(
initial_config_.constraints = ConvertConstraints( initial_config_.constraints = ConvertConstraints(
min_bitrate_bps, max_bitrate_bps, start_bitrate_bps, clock_); min_bitrate_bps, max_bitrate_bps, start_bitrate_bps, clock_);
RTC_DCHECK(start_bitrate_bps > 0); RTC_DCHECK(start_bitrate_bps > 0);
// To be fully compatible with legacy SendSideCongestionController, make sure
// pacer is initialized even if there are no registered streams. This should
// not happen under normal circumstances, but some tests rely on it and there
// are no checks detecting when the legacy SendSideCongestionController is
// used. This way of setting the value has the drawback that it might be wrong
// compared to what the actual value from the congestion controller will be.
// TODO(srte): Remove this when the legacy SendSideCongestionController is
// removed.
pacer_->SetEstimatedBitrate(start_bitrate_bps);
} }
// There is no point in having a network controller for a network that is not // There is no point in having a network controller for a network that is not