| Index: webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller_unittest.cc
|
| diff --git a/webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller_unittest.cc b/webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller_unittest.cc
|
| index 43d4f4f0eae752d89a86bafee2f1eb5c8df6753a..6c62255a9694786346add81903f310868ece5deb 100644
|
| --- a/webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller_unittest.cc
|
| +++ b/webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller_unittest.cc
|
| @@ -20,8 +20,10 @@ namespace {
|
|
|
| constexpr float kFlIncreasingPacketLossFraction = 0.04f;
|
| constexpr float kFlDecreasingPacketLossFraction = 0.05f;
|
| -constexpr int kFl20msTo60msBandwidthBps = 22000;
|
| -constexpr int kFl60msTo20msBandwidthBps = 88000;
|
| +constexpr int kFl20msTo60msBandwidthBps = 40000;
|
| +constexpr int kFl60msTo20msBandwidthBps = 50000;
|
| +constexpr int kFl60msTo120msBandwidthBps = 30000;
|
| +constexpr int kFl120msTo60msBandwidthBps = 40000;
|
| constexpr int kMediumBandwidthBps =
|
| (kFl60msTo20msBandwidthBps + kFl20msTo60msBandwidthBps) / 2;
|
| constexpr float kMediumPacketLossFraction =
|
| @@ -34,7 +36,8 @@ std::unique_ptr<FrameLengthController> CreateController(
|
| new FrameLengthController(FrameLengthController::Config(
|
| encoder_frame_lengths_ms, initial_frame_length_ms,
|
| kFlIncreasingPacketLossFraction, kFlDecreasingPacketLossFraction,
|
| - kFl20msTo60msBandwidthBps, kFl60msTo20msBandwidthBps)));
|
| + kFl20msTo60msBandwidthBps, kFl60msTo20msBandwidthBps,
|
| + kFl60msTo120msBandwidthBps, kFl120msTo60msBandwidthBps)));
|
| return controller;
|
| }
|
|
|
| @@ -179,40 +182,8 @@ TEST(FrameLengthControllerTest, Maintain20MsWhenFecIsOn) {
|
| CheckDecision(controller.get(), rtc::Optional<bool>(true), 20);
|
| }
|
|
|
| -namespace {
|
| -constexpr int kFl60msTo120msBandwidthBps = 18000;
|
| -constexpr int kFl120msTo60msBandwidthBps = 72000;
|
| -}
|
| -
|
| -class FrameLengthControllerForTest {
|
| - public:
|
| - // This class is to test multiple frame lengths. FrameLengthController is
|
| - // implemented to support this, but is not enabled for the default constructor
|
| - // for the time being. We use this class to test it.
|
| - FrameLengthControllerForTest(const std::vector<int>& encoder_frame_lengths_ms,
|
| - int initial_frame_length_ms)
|
| - : frame_length_controller_(
|
| - FrameLengthController::Config(encoder_frame_lengths_ms,
|
| - initial_frame_length_ms,
|
| - kFlIncreasingPacketLossFraction,
|
| - kFlDecreasingPacketLossFraction,
|
| - kFl20msTo60msBandwidthBps,
|
| - kFl60msTo20msBandwidthBps)) {
|
| - frame_length_controller_.frame_length_change_criteria_.insert(
|
| - std::make_pair(FrameLengthController::FrameLengthChange(60, 120),
|
| - kFl60msTo120msBandwidthBps));
|
| - frame_length_controller_.frame_length_change_criteria_.insert(
|
| - std::make_pair(FrameLengthController::FrameLengthChange(120, 60),
|
| - kFl120msTo60msBandwidthBps));
|
| - }
|
| - FrameLengthController* get() { return &frame_length_controller_; }
|
| -
|
| - private:
|
| - FrameLengthController frame_length_controller_;
|
| -};
|
| -
|
| TEST(FrameLengthControllerTest, From120MsTo20MsOnHighUplinkBandwidth) {
|
| - FrameLengthControllerForTest controller({20, 60, 120}, 120);
|
| + auto controller = CreateController({20, 60, 120}, 120);
|
| // It takes two steps for frame length to go from 120ms to 20ms.
|
| UpdateNetworkMetrics(controller.get(),
|
| rtc::Optional<int>(kFl60msTo20msBandwidthBps),
|
| @@ -226,7 +197,7 @@ TEST(FrameLengthControllerTest, From120MsTo20MsOnHighUplinkBandwidth) {
|
| }
|
|
|
| TEST(FrameLengthControllerTest, From120MsTo20MsOnHighUplinkPacketLossFraction) {
|
| - FrameLengthControllerForTest controller({20, 60, 120}, 120);
|
| + auto controller = CreateController({20, 60, 120}, 120);
|
| // It takes two steps for frame length to go from 120ms to 20ms.
|
| UpdateNetworkMetrics(controller.get(), rtc::Optional<int>(),
|
| rtc::Optional<float>(kFlDecreasingPacketLossFraction));
|
| @@ -238,7 +209,7 @@ TEST(FrameLengthControllerTest, From120MsTo20MsOnHighUplinkPacketLossFraction) {
|
| }
|
|
|
| TEST(FrameLengthControllerTest, From120MsTo20MsWhenFecIsOn) {
|
| - FrameLengthControllerForTest controller({20, 60, 120}, 120);
|
| + auto controller = CreateController({20, 60, 120}, 120);
|
| // It takes two steps for frame length to go from 120ms to 20ms.
|
| CheckDecision(controller.get(), rtc::Optional<bool>(true), 60);
|
| CheckDecision(controller.get(), rtc::Optional<bool>(true), 20);
|
| @@ -250,7 +221,7 @@ TEST(FrameLengthControllerTest, From20MsTo120MsOnMultipleConditions) {
|
| // 2. |uplink_packet_loss_fraction| is known to be smaller than a threshold
|
| // AND
|
| // 3. FEC is not decided or OFF.
|
| - FrameLengthControllerForTest controller({20, 60, 120}, 20);
|
| + auto controller = CreateController({20, 60, 120}, 20);
|
| // It takes two steps for frame length to go from 20ms to 120ms.
|
| UpdateNetworkMetrics(controller.get(),
|
| rtc::Optional<int>(kFl60msTo120msBandwidthBps),
|
| @@ -263,7 +234,7 @@ TEST(FrameLengthControllerTest, From20MsTo120MsOnMultipleConditions) {
|
| }
|
|
|
| TEST(FrameLengthControllerTest, Stall60MsIf120MsNotInReceiverFrameLengthRange) {
|
| - FrameLengthControllerForTest controller({20, 60}, 20);
|
| + auto controller = CreateController({20, 60}, 20);
|
| UpdateNetworkMetrics(controller.get(),
|
| rtc::Optional<int>(kFl60msTo120msBandwidthBps),
|
| rtc::Optional<float>(kFlIncreasingPacketLossFraction));
|
| @@ -275,7 +246,7 @@ TEST(FrameLengthControllerTest, Stall60MsIf120MsNotInReceiverFrameLengthRange) {
|
| }
|
|
|
| TEST(FrameLengthControllerTest, CheckBehaviorOnChangingNetworkMetrics) {
|
| - FrameLengthControllerForTest controller({20, 60, 120}, 20);
|
| + auto controller = CreateController({20, 60, 120}, 20);
|
| UpdateNetworkMetrics(controller.get(),
|
| rtc::Optional<int>(kMediumBandwidthBps),
|
| rtc::Optional<float>(kFlIncreasingPacketLossFraction));
|
|
|