2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
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.
11 #include "webrtc/modules/audio_coding/main/acm2/acm_pcma.h"
13 #include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h"
14 #include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
15 #include "webrtc/system_wrappers/interface/trace.h"
23 ACMPCMA::ACMPCMA(int16_t codec_id) { codec_id_ = codec_id; }
25 ACMPCMA::~ACMPCMA() { return; }
27 int16_t ACMPCMA::InternalEncode(uint8_t* bitstream,
28 int16_t* bitstream_len_byte) {
29 *bitstream_len_byte = WebRtcG711_EncodeA(
30 NULL, &in_audio_[in_audio_ix_read_], frame_len_smpl_ * num_channels_,
31 reinterpret_cast<int16_t*>(bitstream));
32 // Increment the read index this tell the caller that how far
33 // we have gone forward in reading the audio buffer.
34 in_audio_ix_read_ += frame_len_smpl_ * num_channels_;
35 return *bitstream_len_byte;
38 int16_t ACMPCMA::InternalInitEncoder(WebRtcACMCodecParams* /* codec_params */) {
39 // This codec does not need initialization, PCM has no instance.
43 ACMGenericCodec* ACMPCMA::CreateInstance(void) { return NULL; }
45 int16_t ACMPCMA::InternalCreateEncoder() {
46 // PCM has no instance.
50 void ACMPCMA::DestructEncoderSafe() {
51 // PCM has no instance.