• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G722_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G722_H_
13 
14 #include "webrtc/modules/audio_coding/main/acm2/acm_generic_codec.h"
15 #include "webrtc/system_wrappers/interface/thread_annotations.h"
16 
17 typedef struct WebRtcG722EncInst G722EncInst;
18 typedef struct WebRtcG722DecInst G722DecInst;
19 
20 namespace webrtc {
21 
22 namespace acm2 {
23 
24 // Forward declaration.
25 struct ACMG722EncStr;
26 struct ACMG722DecStr;
27 
28 class ACMG722 : public ACMGenericCodec {
29  public:
30   explicit ACMG722(int16_t codec_id);
31   ~ACMG722();
32 
33   // For FEC.
34   ACMGenericCodec* CreateInstance(void);
35 
36   int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
37 
38   int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
39 
40  protected:
41   int32_t Add10MsDataSafe(const uint32_t timestamp,
42                           const int16_t* data,
43                           const uint16_t length_smpl,
44                           const uint8_t audio_channel)
45       EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
46 
47   void DestructEncoderSafe();
48 
49   int16_t InternalCreateEncoder();
50 
51   void InternalDestructEncoderInst(void* ptr_inst);
52 
53   ACMG722EncStr* ptr_enc_str_;
54 
55   G722EncInst* encoder_inst_ptr_;
56   G722EncInst* encoder_inst_ptr_right_;  // Prepared for stereo
57 };
58 
59 }  // namespace acm2
60 
61 }  // namespace webrtc
62 
63 #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G722_H_
64