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

Side by Side Diff: webrtc/modules/audio_coding/neteq/audio_decoder_impl.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 unified diff | Download patch
OLDNEW
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
(...skipping 18 matching lines...) Expand all
29 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isa c.h" 29 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isa c.h"
30 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isa c.h" 30 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isa c.h"
31 #endif 31 #endif
32 #ifdef WEBRTC_CODEC_OPUS 32 #ifdef WEBRTC_CODEC_OPUS
33 #include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h" 33 #include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h"
34 #endif 34 #endif
35 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h" 35 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h"
36 36
37 namespace webrtc { 37 namespace webrtc {
38 38
39 AudioDecoderCng::AudioDecoderCng() {
40 RTC_CHECK_EQ(0, WebRtcCng_CreateDec(&dec_state_));
41 WebRtcCng_InitDec(dec_state_);
42 }
43
44 AudioDecoderCng::~AudioDecoderCng() {
45 WebRtcCng_FreeDec(dec_state_);
46 }
47
48 void AudioDecoderCng::Reset() {
49 WebRtcCng_InitDec(dec_state_);
50 }
51
52 int AudioDecoderCng::IncomingPacket(const uint8_t* payload,
53 size_t payload_len,
54 uint16_t rtp_sequence_number,
55 uint32_t rtp_timestamp,
56 uint32_t arrival_timestamp) {
57 return -1;
58 }
59
60 CNG_dec_inst* AudioDecoderCng::CngDecoderInstance() {
61 return dec_state_;
62 }
63
64 size_t AudioDecoderCng::Channels() const {
65 return 1;
66 }
67
68 int AudioDecoderCng::DecodeInternal(const uint8_t* encoded,
69 size_t encoded_len,
70 int sample_rate_hz,
71 int16_t* decoded,
72 SpeechType* speech_type) {
73 return -1;
74 }
75
76 bool CodecSupported(NetEqDecoder codec_type) { 39 bool CodecSupported(NetEqDecoder codec_type) {
77 switch (codec_type) { 40 switch (codec_type) {
78 case NetEqDecoder::kDecoderPCMu: 41 case NetEqDecoder::kDecoderPCMu:
79 case NetEqDecoder::kDecoderPCMa: 42 case NetEqDecoder::kDecoderPCMa:
80 case NetEqDecoder::kDecoderPCMu_2ch: 43 case NetEqDecoder::kDecoderPCMu_2ch:
81 case NetEqDecoder::kDecoderPCMa_2ch: 44 case NetEqDecoder::kDecoderPCMa_2ch:
82 #ifdef WEBRTC_CODEC_ILBC 45 #ifdef WEBRTC_CODEC_ILBC
83 case NetEqDecoder::kDecoderILBC: 46 case NetEqDecoder::kDecoderILBC:
84 #endif 47 #endif
85 #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC) 48 #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 #ifdef WEBRTC_CODEC_OPUS 184 #ifdef WEBRTC_CODEC_OPUS
222 case NetEqDecoder::kDecoderOpus: 185 case NetEqDecoder::kDecoderOpus:
223 return new AudioDecoderOpus(1); 186 return new AudioDecoderOpus(1);
224 case NetEqDecoder::kDecoderOpus_2ch: 187 case NetEqDecoder::kDecoderOpus_2ch:
225 return new AudioDecoderOpus(2); 188 return new AudioDecoderOpus(2);
226 #endif 189 #endif
227 case NetEqDecoder::kDecoderCNGnb: 190 case NetEqDecoder::kDecoderCNGnb:
228 case NetEqDecoder::kDecoderCNGwb: 191 case NetEqDecoder::kDecoderCNGwb:
229 case NetEqDecoder::kDecoderCNGswb32kHz: 192 case NetEqDecoder::kDecoderCNGswb32kHz:
230 case NetEqDecoder::kDecoderCNGswb48kHz: 193 case NetEqDecoder::kDecoderCNGswb48kHz:
231 return new AudioDecoderCng; 194 RTC_CHECK(false && "CNG should not be created like this right now!");
kwiberg-webrtc 2016/04/09 07:34:49 RTC_CHECK(false) << "CNG should not be created lik
ossu 2016/04/11 08:31:10 Acknowledged.
hlundin-webrtc 2016/04/11 11:33:00 I guess RTC_NOTREACHED() is yet another way to say
kwiberg-webrtc 2016/04/11 12:42:56 Yes, but bear in mind that that one uses DCHECK, n
ossu 2016/04/11 12:59:57 It makes sense that NOTREACHED should be in even i
ossu 2016/04/11 12:59:57 Acknowledged.
kwiberg-webrtc 2016/04/11 13:28:26 Yes. Except that the compiler can optimize the sur
232 case NetEqDecoder::kDecoderRED: 195 case NetEqDecoder::kDecoderRED:
233 case NetEqDecoder::kDecoderAVT: 196 case NetEqDecoder::kDecoderAVT:
234 case NetEqDecoder::kDecoderArbitrary: 197 case NetEqDecoder::kDecoderArbitrary:
235 default: { 198 default: {
236 return NULL; 199 return NULL;
237 } 200 }
238 } 201 }
239 } 202 }
240 203
241 } // namespace webrtc 204 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698