Make an enum class out of NetEqDecoder, and hide the neteq_decoders_ table
This operation was relatively simple, since no one was doing anything
fishy with this enum. A large number of lines had to be changed
because the enum values now live in their own namespace, but this is
arguably worth it since it is now much clearer what sort of constant
they are.
BUG=webrtc:5028
Review URL: https://codereview.webrtc.org/1424083002
Cr-Commit-Position: refs/heads/master@{#10449}
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index ecd1ad9..92ce41e 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -174,11 +174,12 @@
return kOK;
}
-int NetEqImpl::RegisterPayloadType(enum NetEqDecoder codec,
+int NetEqImpl::RegisterPayloadType(NetEqDecoder codec,
uint8_t rtp_payload_type) {
CriticalSectionScoped lock(crit_sect_.get());
LOG(LS_VERBOSE) << "RegisterPayloadType "
- << static_cast<int>(rtp_payload_type) << " " << codec;
+ << static_cast<int>(rtp_payload_type) << " "
+ << static_cast<int>(codec);
int ret = decoder_database_->RegisterPayload(rtp_payload_type, codec);
if (ret != DecoderDatabase::kOK) {
switch (ret) {
@@ -200,12 +201,13 @@
}
int NetEqImpl::RegisterExternalDecoder(AudioDecoder* decoder,
- enum NetEqDecoder codec,
+ NetEqDecoder codec,
uint8_t rtp_payload_type,
int sample_rate_hz) {
CriticalSectionScoped lock(crit_sect_.get());
LOG(LS_VERBOSE) << "RegisterExternalDecoder "
- << static_cast<int>(rtp_payload_type) << " " << codec;
+ << static_cast<int>(rtp_payload_type) << " "
+ << static_cast<int>(codec);
if (!decoder) {
LOG(LS_ERROR) << "Cannot register external decoder with NULL pointer";
assert(false);
@@ -1677,16 +1679,16 @@
// Clearly wrong, but will maintain bit-exactness with legacy.
if (fs_hz_ == 8000) {
packet->header.payloadType =
- decoder_database_->GetRtpPayloadType(kDecoderCNGnb);
+ decoder_database_->GetRtpPayloadType(NetEqDecoder::kDecoderCNGnb);
} else if (fs_hz_ == 16000) {
packet->header.payloadType =
- decoder_database_->GetRtpPayloadType(kDecoderCNGwb);
+ decoder_database_->GetRtpPayloadType(NetEqDecoder::kDecoderCNGwb);
} else if (fs_hz_ == 32000) {
- packet->header.payloadType =
- decoder_database_->GetRtpPayloadType(kDecoderCNGswb32kHz);
+ packet->header.payloadType = decoder_database_->GetRtpPayloadType(
+ NetEqDecoder::kDecoderCNGswb32kHz);
} else if (fs_hz_ == 48000) {
- packet->header.payloadType =
- decoder_database_->GetRtpPayloadType(kDecoderCNGswb48kHz);
+ packet->header.payloadType = decoder_database_->GetRtpPayloadType(
+ NetEqDecoder::kDecoderCNGswb48kHz);
}
assert(decoder_database_->IsComfortNoise(packet->header.payloadType));
#else