Home | History | Annotate | Download | only in acm2
      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_OPUS_H_
     12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_OPUS_H_
     13 
     14 #include "webrtc/common_audio/resampler/include/resampler.h"
     15 #include "webrtc/modules/audio_coding/main/acm2/acm_generic_codec.h"
     16 
     17 struct WebRtcOpusEncInst;
     18 struct WebRtcOpusDecInst;
     19 
     20 namespace webrtc {
     21 
     22 namespace acm2 {
     23 
     24 class ACMOpus : public ACMGenericCodec {
     25  public:
     26   explicit ACMOpus(int16_t codec_id);
     27   ~ACMOpus();
     28 
     29   ACMGenericCodec* CreateInstance(void);
     30 
     31   int16_t InternalEncode(uint8_t* bitstream,
     32                          int16_t* bitstream_len_byte) OVERRIDE
     33       EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
     34 
     35   int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
     36 
     37   virtual int SetFEC(bool enable_fec) OVERRIDE;
     38 
     39   virtual int SetPacketLossRate(int loss_rate) OVERRIDE;
     40 
     41   virtual int SetOpusMaxPlaybackRate(int frequency_hz) OVERRIDE;
     42 
     43  protected:
     44   void DestructEncoderSafe();
     45 
     46   int16_t InternalCreateEncoder();
     47 
     48   int16_t SetBitRateSafe(const int32_t rate) OVERRIDE
     49       EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
     50 
     51   WebRtcOpusEncInst* encoder_inst_ptr_;
     52   uint16_t sample_freq_;
     53   int32_t bitrate_;
     54   int channels_;
     55 
     56   int packet_loss_rate_;
     57 };
     58 
     59 }  // namespace acm2
     60 
     61 }  // namespace webrtc
     62 
     63 #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_OPUS_H_
     64