Remove ACMCodecDB::CodecFreq

BUG=webrtc:5028

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

Cr-Commit-Position: refs/heads/master@{#10536}
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 b69f545..0855dd6 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc
@@ -340,14 +340,6 @@
   return CodecId(codec_inst);
 }
 
-// Returns the codec sampling frequency for codec with id = "codec_id" in
-// database.
-int ACMCodecDB::CodecFreq(int codec_id) {
-  const size_t i = static_cast<size_t>(codec_id);
-  const auto db = RentACodec::Database();
-  return i < db.size() ? db[i].plfreq : -1;
-}
-
 }  // 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 ede0e6b..e462e45 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_codec_database.h
+++ b/webrtc/modules/audio_coding/main/acm2/acm_codec_database.h
@@ -74,17 +74,6 @@
   static int CodecId(const char* payload_name, int frequency, int channels);
   static int ReceiverCodecNumber(const CodecInst& codec_inst);
 
-  // Returns the codec sampling frequency for codec with id = "codec_id" in
-  // database.
-  // TODO(tlegrand): Check if function is needed, or if we can change
-  // to access database directly.
-  // Input:
-  //   [codec_id] - number that specifies at what position in the database to
-  //                get the information.
-  // Return:
-  //   codec sampling frequency if successful, otherwise -1.
-  static int CodecFreq(int codec_id);
-
  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/acm_receiver.cc b/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
index b8e8b9d..34726cc 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
@@ -178,7 +178,10 @@
                       << " is not registered.";
       return -1;
     }
-    const int sample_rate_hz = ACMCodecDB::CodecFreq(decoder->acm_codec_id);
+    const int sample_rate_hz = [&decoder] {
+      const auto ci = RentACodec::CodecIdFromIndex(decoder->acm_codec_id);
+      return ci ? RentACodec::CodecInstById(*ci)->plfreq : -1;
+    }();
     receive_timestamp = NowInTimestamp(sample_rate_hz);
 
     // If this is a CNG while the audio codec is not mono, skip pushing in