Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Unified Diff: webrtc/modules/audio_coding/neteq/comfort_noise.cc

Issue 1868143002: Convert CNG into C++ and remove it from AudioDecoder (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/comfort_noise.cc
diff --git a/webrtc/modules/audio_coding/neteq/comfort_noise.cc b/webrtc/modules/audio_coding/neteq/comfort_noise.cc
index a5b08469beaec716e9c5e27424f3244a3ab6ab31..b957598924661410faa511d595a9c5f61e500295 100644
--- a/webrtc/modules/audio_coding/neteq/comfort_noise.cc
+++ b/webrtc/modules/audio_coding/neteq/comfort_noise.cc
@@ -29,15 +29,13 @@ void ComfortNoise::Reset() {
int ComfortNoise::UpdateParameters(Packet* packet) {
assert(packet); // Existence is verified by caller.
// Get comfort noise decoder.
- AudioDecoder* cng_decoder = decoder_database_->GetDecoder(
- packet->header.payloadType);
- if (!cng_decoder) {
+ if (decoder_database_->SetActiveCngDecoder(packet->header.payloadType)
+ != kOK) {
delete [] packet->payload;
delete packet;
return kUnknownPayloadType;
}
- decoder_database_->SetActiveCngDecoder(packet->header.payloadType);
- CNG_dec_inst* cng_inst = cng_decoder->CngDecoderInstance();
+ CNG_dec_inst* cng_inst = decoder_database_->GetActiveCngDecoder();
int16_t ret = WebRtcCng_UpdateSid(cng_inst,
packet->payload,
packet->payload_length);
@@ -71,12 +69,11 @@ int ComfortNoise::Generate(size_t requested_length,
}
output->AssertSize(number_of_samples);
// Get the decoder from the database.
- AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder();
- if (!cng_decoder) {
+ CNG_dec_inst* cng_inst = decoder_database_->GetActiveCngDecoder();
+ if (!cng_inst) {
LOG(LS_ERROR) << "Unknwown payload type";
return kUnknownPayloadType;
}
- CNG_dec_inst* cng_inst = cng_decoder->CngDecoderInstance();
// The expression &(*output)[0][0] is a pointer to the first element in
// the first channel.
if (WebRtcCng_Generate(cng_inst, &(*output)[0][0], number_of_samples,

Powered by Google App Engine
This is Rietveld 408576698