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

Side by Side Diff: webrtc/modules/audio_coding/neteq/audio_decoder_impl.h

Issue 1868143002: Convert CNG into C++ and remove it from AudioDecoder (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Converted WebRtcCng to C++ 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
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_
13 13
14 #include <assert.h> 14 #include <assert.h>
15 15
16 #include "webrtc/engine_configurations.h" 16 #include "webrtc/engine_configurations.h"
17 #include "webrtc/base/constructormagic.h" 17 #include "webrtc/base/constructormagic.h"
18 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" 18 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
19 #include "webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h"
20 #ifdef WEBRTC_CODEC_G722 19 #ifdef WEBRTC_CODEC_G722
21 #include "webrtc/modules/audio_coding/codecs/g722/g722_interface.h" 20 #include "webrtc/modules/audio_coding/codecs/g722/g722_interface.h"
22 #endif 21 #endif
23 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" 22 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
24 #include "webrtc/typedefs.h" 23 #include "webrtc/typedefs.h"
25 24
26 namespace webrtc { 25 namespace webrtc {
27 26
28 // AudioDecoderCng is a special type of AudioDecoder. It inherits from
29 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods
30 // should be used, except constructor, destructor, and accessors.
31 // TODO(hlundin): Consider the possibility to create a super-class to
32 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a
33 // specific CngDecoder class could both inherit from that class.
34 class AudioDecoderCng : public AudioDecoder {
35 public:
36 explicit AudioDecoderCng();
37 ~AudioDecoderCng() override;
38 void Reset() override;
39 int IncomingPacket(const uint8_t* payload,
40 size_t payload_len,
41 uint16_t rtp_sequence_number,
42 uint32_t rtp_timestamp,
43 uint32_t arrival_timestamp) override;
44
45 CNG_dec_inst* CngDecoderInstance() override;
46 size_t Channels() const override;
47
48 protected:
49 int DecodeInternal(const uint8_t* encoded,
50 size_t encoded_len,
51 int sample_rate_hz,
52 int16_t* decoded,
53 SpeechType* speech_type) override;
54
55 private:
56 CNG_dec_inst* dec_state_;
57 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderCng);
58 };
59
60 using NetEqDecoder = acm2::RentACodec::NetEqDecoder; 27 using NetEqDecoder = acm2::RentACodec::NetEqDecoder;
61 28
62 // Returns true if |codec_type| is supported. 29 // Returns true if |codec_type| is supported.
63 bool CodecSupported(NetEqDecoder codec_type); 30 bool CodecSupported(NetEqDecoder codec_type);
64 31
65 // Returns the sample rate for |codec_type|. 32 // Returns the sample rate for |codec_type|.
66 int CodecSampleRateHz(NetEqDecoder codec_type); 33 int CodecSampleRateHz(NetEqDecoder codec_type);
67 34
68 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for 35 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for
69 // unsupported codecs, and when creating an AudioDecoder is not applicable 36 // unsupported codecs, and when creating an AudioDecoder is not applicable
70 // (e.g., for RED and DTMF/AVT types). 37 // (e.g., for RED and DTMF/AVT types).
71 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); 38 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type);
72 39
73 } // namespace webrtc 40 } // namespace webrtc
74 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ 41 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698