| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/modules/audio_coding/neteq/comfort_noise.h" | 11 #include "webrtc/modules/audio_coding/neteq/comfort_noise.h" |
| 12 | 12 |
| 13 #include <assert.h> | 13 #include <assert.h> |
| 14 | 14 |
| 15 #include "webrtc/base/logging.h" | 15 #include "webrtc/base/logging.h" |
| 16 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" | 16 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" |
| 17 #include "webrtc/modules/audio_coding/neteq/decoder_database.h" | 17 #include "webrtc/modules/audio_coding/neteq/decoder_database.h" |
| 18 #include "webrtc/modules/audio_coding/neteq/dsp_helper.h" | 18 #include "webrtc/modules/audio_coding/neteq/dsp_helper.h" |
| 19 #include "webrtc/modules/audio_coding/neteq/sync_buffer.h" | 19 #include "webrtc/modules/audio_coding/neteq/sync_buffer.h" |
| 20 | 20 |
| 21 namespace webrtc { | 21 namespace webrtc { |
| 22 | 22 |
| 23 void ComfortNoise::Reset() { | 23 void ComfortNoise::Reset() { |
| 24 first_call_ = true; | 24 first_call_ = true; |
| 25 } | 25 } |
| 26 | 26 |
| 27 int ComfortNoise::UpdateParameters(Packet* packet) { | 27 int ComfortNoise::UpdateParameters(Packet* packet) { |
| 28 assert(packet); // Existence is verified by caller. | 28 assert(packet); // Existence is verified by caller. |
| 29 // Get comfort noise decoder. | 29 // Get comfort noise decoder. |
| 30 if (decoder_database_->SetActiveCngDecoder(packet->header.payloadType) | 30 if (decoder_database_->SetActiveCngDecoder(packet->payload_type) != kOK) { |
| 31 != kOK) { | |
| 32 delete packet; | 31 delete packet; |
| 33 return kUnknownPayloadType; | 32 return kUnknownPayloadType; |
| 34 } | 33 } |
| 35 ComfortNoiseDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder(); | 34 ComfortNoiseDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder(); |
| 36 RTC_DCHECK(cng_decoder); | 35 RTC_DCHECK(cng_decoder); |
| 37 cng_decoder->UpdateSid(packet->payload); | 36 cng_decoder->UpdateSid(packet->payload); |
| 38 delete packet; | 37 delete packet; |
| 39 return kOK; | 38 return kOK; |
| 40 } | 39 } |
| 41 | 40 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 118 } |
| 120 // Remove |overlap_length_| samples from the front of |output| since they | 119 // Remove |overlap_length_| samples from the front of |output| since they |
| 121 // were mixed into |sync_buffer_| above. | 120 // were mixed into |sync_buffer_| above. |
| 122 output->PopFront(overlap_length_); | 121 output->PopFront(overlap_length_); |
| 123 } | 122 } |
| 124 first_call_ = false; | 123 first_call_ = false; |
| 125 return kOK; | 124 return kOK; |
| 126 } | 125 } |
| 127 | 126 |
| 128 } // namespace webrtc | 127 } // namespace webrtc |
| OLD | NEW |