| 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 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 | 76 |
| 77 int AudioEncoderG722::Num10MsFramesInNextPacket() const { | 77 int AudioEncoderG722::Num10MsFramesInNextPacket() const { |
| 78 return num_10ms_frames_per_packet_; | 78 return num_10ms_frames_per_packet_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 int AudioEncoderG722::Max10MsFramesInAPacket() const { | 81 int AudioEncoderG722::Max10MsFramesInAPacket() const { |
| 82 return num_10ms_frames_per_packet_; | 82 return num_10ms_frames_per_packet_; |
| 83 } | 83 } |
| 84 | 84 |
| 85 int AudioEncoderG722::GetTargetBitrate() const { |
| 86 // 4 bits/sample, 16000 samples/s/channel. |
| 87 return 64000 * NumChannels(); |
| 88 } |
| 89 |
| 85 AudioEncoder::EncodedInfo AudioEncoderG722::EncodeInternal( | 90 AudioEncoder::EncodedInfo AudioEncoderG722::EncodeInternal( |
| 86 uint32_t rtp_timestamp, | 91 uint32_t rtp_timestamp, |
| 87 const int16_t* audio, | 92 const int16_t* audio, |
| 88 size_t max_encoded_bytes, | 93 size_t max_encoded_bytes, |
| 89 uint8_t* encoded) { | 94 uint8_t* encoded) { |
| 90 CHECK_GE(max_encoded_bytes, MaxEncodedBytes()); | 95 CHECK_GE(max_encoded_bytes, MaxEncodedBytes()); |
| 91 | 96 |
| 92 if (num_10ms_frames_buffered_ == 0) | 97 if (num_10ms_frames_buffered_ == 0) |
| 93 first_timestamp_in_buffer_ = rtp_timestamp; | 98 first_timestamp_in_buffer_ = rtp_timestamp; |
| 94 | 99 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 config.payload_type = codec_inst.pltype; | 152 config.payload_type = codec_inst.pltype; |
| 148 return config; | 153 return config; |
| 149 } | 154 } |
| 150 } // namespace | 155 } // namespace |
| 151 | 156 |
| 152 AudioEncoderMutableG722::AudioEncoderMutableG722(const CodecInst& codec_inst) | 157 AudioEncoderMutableG722::AudioEncoderMutableG722(const CodecInst& codec_inst) |
| 153 : AudioEncoderMutableImpl<AudioEncoderG722>(CreateConfig(codec_inst)) { | 158 : AudioEncoderMutableImpl<AudioEncoderG722>(CreateConfig(codec_inst)) { |
| 154 } | 159 } |
| 155 | 160 |
| 156 } // namespace webrtc | 161 } // namespace webrtc |
| OLD | NEW |