* Move constants into the files/functions that use them
* Declare variables in the narrowest scope possible
* Use correct (expected, actual) order for gtest macros
* Remove unused functions
* Untabify
* 80-column limit
* Avoid C-style casts
* Prefer true typed constants to "enum hack" constants
* Print size_t using the right format macro
* Shorten and simplify code
* Other random cleanup bits and style fixes

BUG=none
TEST=none
R=henrik.lundin@webrtc.org, tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/36179004

Cr-Commit-Position: refs/heads/master@{#8467}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8467 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pkasting@chromium.org
2015-02-23 21:28:22 +00:00
parent 722739108a
commit d324546ced
43 changed files with 393 additions and 541 deletions

View File

@ -448,20 +448,12 @@ ACMGenericCodec* ACMCodecDB::CreateCodecInstance(const CodecInst& codec_inst,
// Checks if the bitrate is valid for the codec.
bool ACMCodecDB::IsRateValid(int codec_id, int rate) {
if (database_[codec_id].rate == rate) {
return true;
} else {
return false;
}
return database_[codec_id].rate == rate;
}
// Checks if the bitrate is valid for iSAC.
bool ACMCodecDB::IsISACRateValid(int rate) {
if ((rate == -1) || ((rate <= 56000) && (rate >= 10000))) {
return true;
} else {
return false;
}
return (rate == -1) || ((rate <= 56000) && (rate >= 10000));
}
// Checks if the bitrate is valid for iLBC.
@ -541,27 +533,17 @@ bool ACMCodecDB::IsG7291RateValid(int rate) {
// Checks if the bitrate is valid for Speex.
bool ACMCodecDB::IsSpeexRateValid(int rate) {
if (rate > 2000) {
return true;
} else {
return false;
}
return rate > 2000;
}
// Checks if the bitrate is valid for Opus.
bool ACMCodecDB::IsOpusRateValid(int rate) {
if ((rate < 6000) || (rate > 510000)) {
return false;
}
return true;
return (rate >= 6000) && (rate <= 510000);
}
// Checks if the payload type is in the valid range.
bool ACMCodecDB::ValidPayloadType(int payload_type) {
if ((payload_type < 0) || (payload_type > 127)) {
return false;
}
return true;
return (payload_type >= 0) && (payload_type <= 127);
}
bool ACMCodecDB::OwnsDecoder(int codec_id) {

View File

@ -507,8 +507,8 @@ int32_t AcmReceiver::AddCodec(int acm_codec_id,
// First unregister. Then register with new payload-type/channels.
if (neteq_->RemovePayloadType(decoders_[acm_codec_id].payload_type) !=
NetEq::kOK) {
LOG_F(LS_ERROR) << "Cannot remover payload "
<< static_cast<int>(decoders_[acm_codec_id].payload_type);
LOG_F(LS_ERROR) << "Cannot remove payload "
<< static_cast<int>(decoders_[acm_codec_id].payload_type);
return -1;
}
}
@ -562,7 +562,7 @@ int AcmReceiver::RemoveAllCodecs() {
decoders_[n].registered = false;
} else {
LOG_F(LS_ERROR) << "Cannot remove payload "
<< static_cast<int>(decoders_[n].payload_type);
<< static_cast<int>(decoders_[n].payload_type);
ret_val = -1;
}
}

View File

@ -240,8 +240,6 @@ class AudioCodingModuleImpl : public AudioCodingModule {
AudioDecodingCallStats* stats) const OVERRIDE;
private:
int UnregisterReceiveCodecSafe(int payload_type);
ACMGenericCodec* CreateCodec(const CodecInst& codec);
int InitializeReceiverSafe() EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_);

View File

@ -332,7 +332,6 @@ TEST_F(InitialDelayManagerTest, NoLatePacketAfterCng) {
// Second packet as CNG.
NextRtpHeader(&rtp_info_, &rtp_receive_timestamp_);
const uint8_t kCngPayloadType = 1; // Arbitrary.
rtp_info_.header.payloadType = kCngPayloadType;
manager_->UpdateLastReceivedPacket(rtp_info_, rtp_receive_timestamp_,
InitialDelayManager::kCngPacket, false,