| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |    2  *  Copyright (c) 2014 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_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_ISAC
     FIX_H_ |   11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_ISAC
     FIX_H_ | 
|   12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_ISAC
     FIX_H_ |   12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_ISAC
     FIX_H_ | 
|   13  |   13  | 
|   14 #include "webrtc/base/checks.h" |  | 
|   15 #include "webrtc/base/scoped_ptr.h" |  | 
|   16 #include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h" |   14 #include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h" | 
|   17 #include "webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h" |   15 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/isac_fix_type.h" | 
|   18  |   16  | 
|   19 namespace webrtc { |   17 namespace webrtc { | 
|   20  |   18  | 
|   21 struct IsacFix { |  | 
|   22   typedef ISACFIX_MainStruct instance_type; |  | 
|   23   static const bool has_swb = false; |  | 
|   24   static const uint16_t kFixSampleRate = 16000; |  | 
|   25   static inline int16_t Control(instance_type* inst, |  | 
|   26                                 int32_t rate, |  | 
|   27                                 int framesize) { |  | 
|   28     return WebRtcIsacfix_Control(inst, rate, framesize); |  | 
|   29   } |  | 
|   30   static inline int16_t ControlBwe(instance_type* inst, |  | 
|   31                                    int32_t rate_bps, |  | 
|   32                                    int frame_size_ms, |  | 
|   33                                    int16_t enforce_frame_size) { |  | 
|   34     return WebRtcIsacfix_ControlBwe(inst, rate_bps, frame_size_ms, |  | 
|   35                                     enforce_frame_size); |  | 
|   36   } |  | 
|   37   static inline int16_t Create(instance_type** inst) { |  | 
|   38     return WebRtcIsacfix_Create(inst); |  | 
|   39   } |  | 
|   40   static inline int DecodeInternal(instance_type* inst, |  | 
|   41                                    const uint8_t* encoded, |  | 
|   42                                    size_t len, |  | 
|   43                                    int16_t* decoded, |  | 
|   44                                    int16_t* speech_type) { |  | 
|   45     return WebRtcIsacfix_Decode(inst, encoded, len, decoded, speech_type); |  | 
|   46   } |  | 
|   47   static inline size_t DecodePlc(instance_type* inst, |  | 
|   48                                  int16_t* decoded, |  | 
|   49                                  size_t num_lost_frames) { |  | 
|   50     return WebRtcIsacfix_DecodePlc(inst, decoded, num_lost_frames); |  | 
|   51   } |  | 
|   52   static inline void DecoderInit(instance_type* inst) { |  | 
|   53     WebRtcIsacfix_DecoderInit(inst); |  | 
|   54   } |  | 
|   55   static inline int Encode(instance_type* inst, |  | 
|   56                            const int16_t* speech_in, |  | 
|   57                            uint8_t* encoded) { |  | 
|   58     return WebRtcIsacfix_Encode(inst, speech_in, encoded); |  | 
|   59   } |  | 
|   60   static inline int16_t EncoderInit(instance_type* inst, int16_t coding_mode) { |  | 
|   61     return WebRtcIsacfix_EncoderInit(inst, coding_mode); |  | 
|   62   } |  | 
|   63   static inline uint16_t EncSampRate(instance_type* inst) { |  | 
|   64     return kFixSampleRate; |  | 
|   65   } |  | 
|   66  |  | 
|   67   static inline int16_t Free(instance_type* inst) { |  | 
|   68     return WebRtcIsacfix_Free(inst); |  | 
|   69   } |  | 
|   70   static inline void GetBandwidthInfo(instance_type* inst, |  | 
|   71                                       IsacBandwidthInfo* bwinfo) { |  | 
|   72     WebRtcIsacfix_GetBandwidthInfo(inst, bwinfo); |  | 
|   73   } |  | 
|   74   static inline int16_t GetErrorCode(instance_type* inst) { |  | 
|   75     return WebRtcIsacfix_GetErrorCode(inst); |  | 
|   76   } |  | 
|   77  |  | 
|   78   static inline int16_t GetNewFrameLen(instance_type* inst) { |  | 
|   79     return WebRtcIsacfix_GetNewFrameLen(inst); |  | 
|   80   } |  | 
|   81   static inline void SetBandwidthInfo(instance_type* inst, |  | 
|   82                                       const IsacBandwidthInfo* bwinfo) { |  | 
|   83     WebRtcIsacfix_SetBandwidthInfo(inst, bwinfo); |  | 
|   84   } |  | 
|   85   static inline int16_t SetDecSampRate(instance_type* inst, |  | 
|   86                                        uint16_t sample_rate_hz) { |  | 
|   87     RTC_DCHECK_EQ(sample_rate_hz, kFixSampleRate); |  | 
|   88     return 0; |  | 
|   89   } |  | 
|   90   static inline int16_t SetEncSampRate(instance_type* inst, |  | 
|   91                                        uint16_t sample_rate_hz) { |  | 
|   92     RTC_DCHECK_EQ(sample_rate_hz, kFixSampleRate); |  | 
|   93     return 0; |  | 
|   94   } |  | 
|   95   static inline void SetEncSampRateInDecoder(instance_type* inst, |  | 
|   96                                              uint16_t sample_rate_hz) { |  | 
|   97     RTC_DCHECK_EQ(sample_rate_hz, kFixSampleRate); |  | 
|   98   } |  | 
|   99   static inline void SetInitialBweBottleneck( |  | 
|  100       instance_type* inst, |  | 
|  101       int bottleneck_bits_per_second) { |  | 
|  102     WebRtcIsacfix_SetInitialBweBottleneck(inst, bottleneck_bits_per_second); |  | 
|  103   } |  | 
|  104   static inline int16_t UpdateBwEstimate(instance_type* inst, |  | 
|  105                                          const uint8_t* encoded, |  | 
|  106                                          size_t packet_size, |  | 
|  107                                          uint16_t rtp_seq_number, |  | 
|  108                                          uint32_t send_ts, |  | 
|  109                                          uint32_t arr_ts) { |  | 
|  110     return WebRtcIsacfix_UpdateBwEstimate(inst, encoded, packet_size, |  | 
|  111                                           rtp_seq_number, send_ts, arr_ts); |  | 
|  112   } |  | 
|  113   static inline int16_t SetMaxPayloadSize(instance_type* inst, |  | 
|  114                                           int16_t max_payload_size_bytes) { |  | 
|  115     return WebRtcIsacfix_SetMaxPayloadSize(inst, max_payload_size_bytes); |  | 
|  116   } |  | 
|  117   static inline int16_t SetMaxRate(instance_type* inst, int32_t max_bit_rate) { |  | 
|  118     return WebRtcIsacfix_SetMaxRate(inst, max_bit_rate); |  | 
|  119   } |  | 
|  120 }; |  | 
|  121  |  | 
|  122 using AudioEncoderIsacFix = AudioEncoderIsacT<IsacFix>; |   19 using AudioEncoderIsacFix = AudioEncoderIsacT<IsacFix>; | 
|  123 using AudioDecoderIsacFix = AudioDecoderIsacT<IsacFix>; |  | 
|  124  |   20  | 
|  125 }  // namespace webrtc |   21 }  // namespace webrtc | 
|  126 #endif  // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_I
     SACFIX_H_ |   22 #endif  // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_I
     SACFIX_H_ | 
| OLD | NEW |