Remove ACMCodecDB::CodecFreq

BUG=webrtc:5028

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

Cr-Commit-Position: refs/heads/master@{#10536}
This commit is contained in:
kwiberg 2015-11-06 01:24:08 -08:00 committed by Commit bot
parent 288886b2ec
commit fb3d8b3df2
3 changed files with 4 additions and 20 deletions

View File

@ -340,14 +340,6 @@ int ACMCodecDB::ReceiverCodecNumber(const CodecInst& codec_inst) {
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

View File

@ -74,17 +74,6 @@ class ACMCodecDB {
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,

View File

@ -178,7 +178,10 @@ int AcmReceiver::InsertPacket(const WebRtcRTPHeader& rtp_header,
<< " 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