Move ACMCodecDB::ValidPayloadType to RentACodec

BUG=webrtc:5028

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

Cr-Commit-Position: refs/heads/master@{#10525}
diff --git a/webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc b/webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc
index 59bb233..b69f545 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc
@@ -244,7 +244,7 @@
   }
 
   // Checks the validity of payload type
-  if (!ValidPayloadType(codec_inst.pltype)) {
+  if (!RentACodec::IsPayloadTypeValid(codec_inst.pltype)) {
     return kInvalidPayloadtype;
   }
 
@@ -348,11 +348,6 @@
   return i < db.size() ? db[i].plfreq : -1;
 }
 
-// Checks if the payload type is in the valid range.
-bool ACMCodecDB::ValidPayloadType(int payload_type) {
-  return (payload_type >= 0) && (payload_type <= 127);
-}
-
 }  // namespace acm2
 
 }  // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/acm2/acm_codec_database.h b/webrtc/modules/audio_coding/main/acm2/acm_codec_database.h
index 885d106..ede0e6b 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_codec_database.h
+++ b/webrtc/modules/audio_coding/main/acm2/acm_codec_database.h
@@ -85,12 +85,6 @@
   //   codec sampling frequency if successful, otherwise -1.
   static int CodecFreq(int codec_id);
 
-  // Check if the payload type is valid, meaning that it is in the valid range
-  // of 0 to 127.
-  // Input:
-  //   [payload_type] - payload type.
-  static bool ValidPayloadType(int payload_type);
-
  private:
   // Databases with information about the supported codecs
   // database_ - stored information about all codecs: payload type, name,
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 aea64c9..260f8a8 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
@@ -563,7 +563,7 @@
   RTC_CHECK(codec_index) << "Invalid codec ID: " << static_cast<int>(*codec_id);
 
   // Check if the payload-type is valid.
-  if (!ACMCodecDB::ValidPayloadType(codec.pltype)) {
+  if (!RentACodec::IsPayloadTypeValid(codec.pltype)) {
     LOG_F(LS_ERROR) << "Invalid payload type " << codec.pltype << " for "
                     << codec.plname;
     return -1;
@@ -589,7 +589,7 @@
   }
 
   // Check if the payload-type is valid.
-  if (!ACMCodecDB::ValidPayloadType(rtp_payload_type)) {
+  if (!RentACodec::IsPayloadTypeValid(rtp_payload_type)) {
     LOG_F(LS_ERROR) << "Invalid payload-type " << rtp_payload_type
                     << " for external decoder.";
     return -1;
diff --git a/webrtc/modules/audio_coding/main/acm2/codec_manager.cc b/webrtc/modules/audio_coding/main/acm2/codec_manager.cc
index a130326..4d24505 100644
--- a/webrtc/modules/audio_coding/main/acm2/codec_manager.cc
+++ b/webrtc/modules/audio_coding/main/acm2/codec_manager.cc
@@ -46,16 +46,6 @@
     return -1;
   }
 
-  // TODO(tlegrand): Remove this check. Already taken care of in
-  // ACMCodecDB::CodecNumber().
-  // Check if the payload-type is valid
-  if (!ACMCodecDB::ValidPayloadType(send_codec.pltype)) {
-    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id,
-                 "Invalid payload-type %d for %s.", send_codec.pltype,
-                 send_codec.plname);
-    return -1;
-  }
-
   // Telephone-event cannot be a send codec.
   if (!STR_CASE_CMP(send_codec.plname, "telephone-event")) {
     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id,
@@ -198,7 +188,7 @@
     // TODO(tlegrand): Remove this check. Already taken care of in
     // ACMCodecDB::CodecNumber().
     // Check if the payload-type is valid
-    if (!ACMCodecDB::ValidPayloadType(send_codec.pltype)) {
+    if (!RentACodec::IsPayloadTypeValid(send_codec.pltype)) {
       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id,
                    "Invalid payload-type %d for %s.", send_codec.pltype,
                    send_codec.plname);
diff --git a/webrtc/modules/audio_coding/main/acm2/rent_a_codec.h b/webrtc/modules/audio_coding/main/acm2/rent_a_codec.h
index 50d8c54..98052e7 100644
--- a/webrtc/modules/audio_coding/main/acm2/rent_a_codec.h
+++ b/webrtc/modules/audio_coding/main/acm2/rent_a_codec.h
@@ -152,6 +152,11 @@
                                                  int sampling_freq_hz,
                                                  int channels);
   static bool IsCodecValid(const CodecInst& codec_inst);
+
+  static inline bool IsPayloadTypeValid(int payload_type) {
+    return payload_type >= 0 && payload_type <= 127;
+  }
+
   static rtc::ArrayView<const CodecInst> Database();
 
   static rtc::Maybe<bool> IsSupportedNumChannels(CodecId codec_id,