| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 return num_10ms_frames_per_packet_; | 86 return num_10ms_frames_per_packet_; |
| 87 } | 87 } |
| 88 | 88 |
| 89 int AudioEncoderG722::GetTargetBitrate() const { | 89 int AudioEncoderG722::GetTargetBitrate() const { |
| 90 // 4 bits/sample, 16000 samples/s/channel. | 90 // 4 bits/sample, 16000 samples/s/channel. |
| 91 return 64000 * NumChannels(); | 91 return 64000 * NumChannels(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 AudioEncoder::EncodedInfo AudioEncoderG722::EncodeInternal( | 94 AudioEncoder::EncodedInfo AudioEncoderG722::EncodeInternal( |
| 95 uint32_t rtp_timestamp, | 95 uint32_t rtp_timestamp, |
| 96 const int16_t* audio, | 96 rtc::ArrayView<const int16_t> audio, |
| 97 size_t max_encoded_bytes, | 97 size_t max_encoded_bytes, |
| 98 uint8_t* encoded) { | 98 uint8_t* encoded) { |
| 99 RTC_CHECK_GE(max_encoded_bytes, MaxEncodedBytes()); | 99 RTC_CHECK_GE(max_encoded_bytes, MaxEncodedBytes()); |
| 100 | 100 |
| 101 if (num_10ms_frames_buffered_ == 0) | 101 if (num_10ms_frames_buffered_ == 0) |
| 102 first_timestamp_in_buffer_ = rtp_timestamp; | 102 first_timestamp_in_buffer_ = rtp_timestamp; |
| 103 | 103 |
| 104 // Deinterleave samples and save them in each channel's buffer. | 104 // Deinterleave samples and save them in each channel's buffer. |
| 105 const size_t start = kSampleRateHz / 100 * num_10ms_frames_buffered_; | 105 const size_t start = kSampleRateHz / 100 * num_10ms_frames_buffered_; |
| 106 for (size_t i = 0; i < kSampleRateHz / 100; ++i) | 106 for (size_t i = 0; i < kSampleRateHz / 100; ++i) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 AudioEncoderG722::EncoderState::~EncoderState() { | 156 AudioEncoderG722::EncoderState::~EncoderState() { |
| 157 RTC_CHECK_EQ(0, WebRtcG722_FreeEncoder(encoder)); | 157 RTC_CHECK_EQ(0, WebRtcG722_FreeEncoder(encoder)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 size_t AudioEncoderG722::SamplesPerChannel() const { | 160 size_t AudioEncoderG722::SamplesPerChannel() const { |
| 161 return kSampleRateHz / 100 * num_10ms_frames_per_packet_; | 161 return kSampleRateHz / 100 * num_10ms_frames_per_packet_; |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace webrtc | 164 } // namespace webrtc |
| OLD | NEW |