Remove AudioEncoder methods SetMaxBitrate and SetMaxPayloadSize

And the corresponding ACM methods SetISACMaxRate and
SetISACMaxPayloadSize. They were only used in tests.

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

Cr-Commit-Position: refs/heads/master@{#9903}
diff --git a/webrtc/modules/audio_coding/codecs/audio_encoder.cc b/webrtc/modules/audio_coding/codecs/audio_encoder.cc
index 8974cf1..c0c20be 100644
--- a/webrtc/modules/audio_coding/codecs/audio_encoder.cc
+++ b/webrtc/modules/audio_coding/codecs/audio_encoder.cc
@@ -52,8 +52,4 @@
 
 void AudioEncoder::SetTargetBitrate(int target_bps) {}
 
-void AudioEncoder::SetMaxBitrate(int max_bps) {}
-
-void AudioEncoder::SetMaxPayloadSize(int max_payload_size_bytes) {}
-
 }  // namespace webrtc
diff --git a/webrtc/modules/audio_coding/codecs/audio_encoder.h b/webrtc/modules/audio_coding/codecs/audio_encoder.h
index c053b7f..cda9d86 100644
--- a/webrtc/modules/audio_coding/codecs/audio_encoder.h
+++ b/webrtc/modules/audio_coding/codecs/audio_encoder.h
@@ -138,16 +138,6 @@
   // encoder is free to adjust or disregard the given bitrate (the default
   // implementation does the latter).
   virtual void SetTargetBitrate(int target_bps);
-
-  // Sets the maximum bitrate which must not be exceeded for any packet. The
-  // encoder is free to adjust or disregard this value (the default
-  // implementation does the latter).
-  virtual void SetMaxBitrate(int max_bps);
-
-  // Sets an upper limit on the size of packet payloads produced by the
-  // encoder. The encoder is free to adjust or disregard this value (the
-  // default implementation does the latter).
-  virtual void SetMaxPayloadSize(int max_payload_size_bytes);
 };
 }  // namespace webrtc
 #endif  // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_
diff --git a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
index ab3bd77..2fe58c9 100644
--- a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
+++ b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
@@ -199,14 +199,6 @@
   speech_encoder_->SetTargetBitrate(bits_per_second);
 }
 
-void AudioEncoderCng::SetMaxBitrate(int max_bps) {
-  speech_encoder_->SetMaxBitrate(max_bps);
-}
-
-void AudioEncoderCng::SetMaxPayloadSize(int max_payload_size_bytes) {
-  speech_encoder_->SetMaxPayloadSize(max_payload_size_bytes);
-}
-
 AudioEncoder::EncodedInfo AudioEncoderCng::EncodePassive(
     size_t frames_to_encode,
     size_t max_encoded_bytes,
diff --git a/webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h b/webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h
index fd2aa12..b025bc2 100644
--- a/webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h
+++ b/webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h
@@ -67,8 +67,6 @@
   void SetMaxPlaybackRate(int frequency_hz) override;
   void SetProjectedPacketLossRate(double fraction) override;
   void SetTargetBitrate(int target_bps) override;
-  void SetMaxBitrate(int max_bps) override;
-  void SetMaxPayloadSize(int max_payload_size_bytes) override;
 
  private:
   EncodedInfo EncodePassive(size_t frames_to_encode,
diff --git a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
index 5484395..686b45a 100644
--- a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
+++ b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
@@ -67,8 +67,6 @@
                              size_t max_encoded_bytes,
                              uint8_t* encoded) override;
   void Reset() override;
-  void SetMaxPayloadSize(int max_payload_size_bytes) override;
-  void SetMaxBitrate(int max_rate_bps) override;
 
  private:
   // This value is taken from STREAM_SIZE_MAX_60 for iSAC float (60 ms) and
diff --git a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
index ad09c3f..3cc635c 100644
--- a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
+++ b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
@@ -158,20 +158,6 @@
 }
 
 template <typename T>
-void AudioEncoderIsacT<T>::SetMaxPayloadSize(int max_payload_size_bytes) {
-  auto conf = config_;
-  conf.max_payload_size_bytes = max_payload_size_bytes;
-  RecreateEncoderInstance(conf);
-}
-
-template <typename T>
-void AudioEncoderIsacT<T>::SetMaxBitrate(int max_rate_bps) {
-  auto conf = config_;
-  conf.max_bit_rate = max_rate_bps;
-  RecreateEncoderInstance(conf);
-}
-
-template <typename T>
 void AudioEncoderIsacT<T>::RecreateEncoderInstance(const Config& config) {
   CHECK(config.IsOk());
   packet_in_progress_ = false;
diff --git a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc
index 46febf7..c8ae53f 100644
--- a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc
+++ b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc
@@ -121,12 +121,4 @@
   speech_encoder_->SetTargetBitrate(bits_per_second);
 }
 
-void AudioEncoderCopyRed::SetMaxBitrate(int max_bps) {
-  speech_encoder_->SetMaxBitrate(max_bps);
-}
-
-void AudioEncoderCopyRed::SetMaxPayloadSize(int max_payload_size_bytes) {
-  speech_encoder_->SetMaxPayloadSize(max_payload_size_bytes);
-}
-
 }  // namespace webrtc
diff --git a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h
index d0fcd41..1d35f95 100644
--- a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h
+++ b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h
@@ -54,8 +54,6 @@
   void SetMaxPlaybackRate(int frequency_hz) override;
   void SetProjectedPacketLossRate(double fraction) override;
   void SetTargetBitrate(int target_bps) override;
-  void SetMaxBitrate(int max_bps) override;
-  void SetMaxPayloadSize(int max_payload_size_bytes) override;
 
  private:
   AudioEncoder* speech_encoder_;
diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc
index 571a509..cb07cd6 100644
--- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc
+++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc
@@ -739,30 +739,6 @@
   return 0;
 }
 
-// TODO(henrik.lundin): Remove? Only used in tests. Deprecated in VoiceEngine.
-int AudioCodingModuleImpl::SetISACMaxRate(int max_bit_per_sec) {
-  CriticalSectionScoped lock(acm_crit_sect_.get());
-
-  if (!HaveValidEncoder("SetISACMaxRate")) {
-    return -1;
-  }
-
-  codec_manager_.CurrentEncoder()->SetMaxBitrate(max_bit_per_sec);
-  return 0;
-}
-
-// TODO(henrik.lundin): Remove? Only used in tests. Deprecated in VoiceEngine.
-int AudioCodingModuleImpl::SetISACMaxPayloadSize(int max_size_bytes) {
-  CriticalSectionScoped lock(acm_crit_sect_.get());
-
-  if (!HaveValidEncoder("SetISACMaxPayloadSize")) {
-    return -1;
-  }
-
-  codec_manager_.CurrentEncoder()->SetMaxPayloadSize(max_size_bytes);
-  return 0;
-}
-
 int AudioCodingModuleImpl::SetOpusApplication(OpusApplicationMode application) {
   CriticalSectionScoped lock(acm_crit_sect_.get());
   if (!HaveValidEncoder("SetOpusApplication")) {
diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.h b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.h
index 568bf92..837cd11 100644
--- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.h
+++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.h
@@ -185,10 +185,6 @@
 
   int GetNetworkStatistics(NetworkStatistics* statistics) override;
 
-  int SetISACMaxRate(int max_bit_per_sec) override;
-
-  int SetISACMaxPayloadSize(int max_size_bytes) override;
-
   int SetOpusApplication(OpusApplicationMode application) override;
 
   // If current send codec is Opus, informs it about the maximum playback rate
diff --git a/webrtc/modules/audio_coding/main/interface/audio_coding_module.h b/webrtc/modules/audio_coding/main/interface/audio_coding_module.h
index 085dd61..0d3d5da 100644
--- a/webrtc/modules/audio_coding/main/interface/audio_coding_module.h
+++ b/webrtc/modules/audio_coding/main/interface/audio_coding_module.h
@@ -723,40 +723,6 @@
   //
 
   ///////////////////////////////////////////////////////////////////////////
-  // int32_t SetISACMaxRate()
-  // Set the maximum instantaneous rate of iSAC. For a payload of B bits
-  // with a frame-size of T sec the instantaneous rate is B/T bits per
-  // second. Therefore, (B/T < |max_rate_bps|) and
-  // (B < |max_payload_len_bytes| * 8) are always satisfied for iSAC payloads,
-  // c.f SetISACMaxPayloadSize().
-  //
-  // Input:
-  //   -max_rate_bps       : maximum instantaneous bit-rate given in bits/sec.
-  //
-  // Return value:
-  //   -1 if failed to set the maximum rate.
-  //    0 if the maximum rate is set successfully.
-  //
-  virtual int SetISACMaxRate(int max_rate_bps) = 0;
-
-  ///////////////////////////////////////////////////////////////////////////
-  // int32_t SetISACMaxPayloadSize()
-  // Set the maximum payload size of iSAC packets. No iSAC payload,
-  // regardless of its frame-size, may exceed the given limit. For
-  // an iSAC payload of size B bits and frame-size T seconds we have;
-  // (B < |max_payload_len_bytes| * 8) and (B/T < |max_rate_bps|), c.f.
-  // SetISACMaxRate().
-  //
-  // Input:
-  //   -max_payload_len_bytes : maximum payload size in bytes.
-  //
-  // Return value:
-  //   -1 if failed to set the maximum  payload-size.
-  //    0 if the given length is set successfully.
-  //
-  virtual int SetISACMaxPayloadSize(int max_payload_len_bytes) = 0;
-
-  ///////////////////////////////////////////////////////////////////////////
   // int SetOpusApplication()
   // Sets the intended application if current send codec is Opus. Opus uses this
   // to optimize the encoding for applications like VOIP and music. Currently,
diff --git a/webrtc/modules/audio_coding/main/test/iSACTest.cc b/webrtc/modules/audio_coding/main/test/iSACTest.cc
index cc41e3b..bd796d1 100644
--- a/webrtc/modules/audio_coding/main/test/iSACTest.cc
+++ b/webrtc/modules/audio_coding/main/test/iSACTest.cc
@@ -35,8 +35,6 @@
 void SetISACConfigDefault(ACMTestISACConfig& isacConfig) {
   isacConfig.currentRateBitPerSec = 0;
   isacConfig.currentFrameSizeMsec = 0;
-  isacConfig.maxRateBitPerSec = 0;
-  isacConfig.maxPayloadSizeByte = 0;
   isacConfig.encodingMode = -1;
   isacConfig.initRateBitPerSec = 0;
   isacConfig.initFrameSizeInMsec = 0;
@@ -67,15 +65,6 @@
     }
   }
 
-  if (isacConfig.maxRateBitPerSec > 0) {
-    // Set max rate.
-    EXPECT_EQ(0, acm->SetISACMaxRate(isacConfig.maxRateBitPerSec));
-  }
-  if (isacConfig.maxPayloadSizeByte > 0) {
-    // Set max payload size.
-    EXPECT_EQ(0, acm->SetISACMaxPayloadSize(isacConfig.maxPayloadSizeByte));
-  }
-
   return 0;
 }
 
@@ -193,39 +182,6 @@
   testNr++;
   EncodeDecode(testNr, wbISACConfig, swbISACConfig);
 
-  int user_input;
-  if ((_testMode == 0) || (_testMode == 1)) {
-    swbISACConfig.maxPayloadSizeByte = static_cast<uint16_t>(200);
-    wbISACConfig.maxPayloadSizeByte = static_cast<uint16_t>(200);
-  } else {
-    printf("Enter the max payload-size for side A: ");
-    CHECK_ERROR(scanf("%d", &user_input));
-    swbISACConfig.maxPayloadSizeByte = (uint16_t) user_input;
-    printf("Enter the max payload-size for side B: ");
-    CHECK_ERROR(scanf("%d", &user_input));
-    wbISACConfig.maxPayloadSizeByte = (uint16_t) user_input;
-  }
-  testNr++;
-  EncodeDecode(testNr, wbISACConfig, swbISACConfig);
-
-  SetISACConfigDefault(wbISACConfig);
-  SetISACConfigDefault(swbISACConfig);
-
-  if ((_testMode == 0) || (_testMode == 1)) {
-    swbISACConfig.maxRateBitPerSec = static_cast<uint32_t>(48000);
-    wbISACConfig.maxRateBitPerSec = static_cast<uint32_t>(48000);
-  } else {
-    printf("Enter the max rate for side A: ");
-    CHECK_ERROR(scanf("%d", &user_input));
-    swbISACConfig.maxRateBitPerSec = (uint32_t) user_input;
-    printf("Enter the max rate for side B: ");
-    CHECK_ERROR(scanf("%d", &user_input));
-    wbISACConfig.maxRateBitPerSec = (uint32_t) user_input;
-  }
-
-  testNr++;
-  EncodeDecode(testNr, wbISACConfig, swbISACConfig);
-
   testNr++;
   if (_testMode == 0) {
     SwitchingSamplingRate(testNr, 4);
diff --git a/webrtc/modules/audio_coding/main/test/iSACTest.h b/webrtc/modules/audio_coding/main/test/iSACTest.h
index f4223f7..8f892d9 100644
--- a/webrtc/modules/audio_coding/main/test/iSACTest.h
+++ b/webrtc/modules/audio_coding/main/test/iSACTest.h
@@ -29,8 +29,6 @@
 struct ACMTestISACConfig {
   int32_t currentRateBitPerSec;
   int16_t currentFrameSizeMsec;
-  uint32_t maxRateBitPerSec;
-  int16_t maxPayloadSizeByte;
   int16_t encodingMode;
   uint32_t initRateBitPerSec;
   int16_t initFrameSizeInMsec;