Move ACMCodecDB::ValidPayloadType to RentACodec
BUG=webrtc:5028 Review URL: https://codereview.webrtc.org/1430043003 Cr-Commit-Position: refs/heads/master@{#10525}
This commit is contained in:
@ -244,7 +244,7 @@ int ACMCodecDB::CodecNumber(const CodecInst& codec_inst) {
|
||||
}
|
||||
|
||||
// Checks the validity of payload type
|
||||
if (!ValidPayloadType(codec_inst.pltype)) {
|
||||
if (!RentACodec::IsPayloadTypeValid(codec_inst.pltype)) {
|
||||
return kInvalidPayloadtype;
|
||||
}
|
||||
|
||||
@ -348,11 +348,6 @@ int ACMCodecDB::CodecFreq(int codec_id) {
|
||||
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
|
||||
|
@ -85,12 +85,6 @@ class ACMCodecDB {
|
||||
// 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,
|
||||
|
@ -563,7 +563,7 @@ int AudioCodingModuleImpl::RegisterReceiveCodec(const CodecInst& codec) {
|
||||
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 @@ int AudioCodingModuleImpl::RegisterExternalReceiveCodec(
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
@ -46,16 +46,6 @@ int IsValidSendCodec(const CodecInst& send_codec, bool is_primary_encoder) {
|
||||
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 @@ int CodecManager::RegisterEncoder(const CodecInst& send_codec) {
|
||||
// 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);
|
||||
|
@ -152,6 +152,11 @@ class RentACodec {
|
||||
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,
|
||||
|
Reference in New Issue
Block a user