| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 size_t AudioEncoderPcm::Num10MsFramesInNextPacket() const { | 77 size_t AudioEncoderPcm::Num10MsFramesInNextPacket() const { |
| 78 return num_10ms_frames_per_packet_; | 78 return num_10ms_frames_per_packet_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 size_t AudioEncoderPcm::Max10MsFramesInAPacket() const { | 81 size_t AudioEncoderPcm::Max10MsFramesInAPacket() const { |
| 82 return num_10ms_frames_per_packet_; | 82 return num_10ms_frames_per_packet_; |
| 83 } | 83 } |
| 84 | 84 |
| 85 int AudioEncoderPcm::GetTargetBitrate() const { | 85 int AudioEncoderPcm::GetTargetBitrate() const { |
| 86 return 8 * BytesPerSample() * SampleRateHz() * NumChannels(); | 86 return static_cast<int>( |
| 87 8 * BytesPerSample() * SampleRateHz() * NumChannels()); |
| 87 } | 88 } |
| 88 | 89 |
| 89 AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeInternal( | 90 AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeInternal( |
| 90 uint32_t rtp_timestamp, | 91 uint32_t rtp_timestamp, |
| 91 rtc::ArrayView<const int16_t> audio, | 92 rtc::ArrayView<const int16_t> audio, |
| 92 size_t max_encoded_bytes, | 93 size_t max_encoded_bytes, |
| 93 uint8_t* encoded) { | 94 uint8_t* encoded) { |
| 94 if (speech_buffer_.empty()) { | 95 if (speech_buffer_.empty()) { |
| 95 first_timestamp_in_buffer_ = rtp_timestamp; | 96 first_timestamp_in_buffer_ = rtp_timestamp; |
| 96 } | 97 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 115 | 116 |
| 116 AudioEncoderPcmA::AudioEncoderPcmA(const CodecInst& codec_inst) | 117 AudioEncoderPcmA::AudioEncoderPcmA(const CodecInst& codec_inst) |
| 117 : AudioEncoderPcmA(CreateConfig<AudioEncoderPcmA>(codec_inst)) {} | 118 : AudioEncoderPcmA(CreateConfig<AudioEncoderPcmA>(codec_inst)) {} |
| 118 | 119 |
| 119 size_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, | 120 size_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, |
| 120 size_t input_len, | 121 size_t input_len, |
| 121 uint8_t* encoded) { | 122 uint8_t* encoded) { |
| 122 return WebRtcG711_EncodeA(audio, input_len, encoded); | 123 return WebRtcG711_EncodeA(audio, input_len, encoded); |
| 123 } | 124 } |
| 124 | 125 |
| 125 int AudioEncoderPcmA::BytesPerSample() const { | 126 size_t AudioEncoderPcmA::BytesPerSample() const { |
| 126 return 1; | 127 return 1; |
| 127 } | 128 } |
| 128 | 129 |
| 129 AudioEncoderPcmU::AudioEncoderPcmU(const CodecInst& codec_inst) | 130 AudioEncoderPcmU::AudioEncoderPcmU(const CodecInst& codec_inst) |
| 130 : AudioEncoderPcmU(CreateConfig<AudioEncoderPcmU>(codec_inst)) {} | 131 : AudioEncoderPcmU(CreateConfig<AudioEncoderPcmU>(codec_inst)) {} |
| 131 | 132 |
| 132 size_t AudioEncoderPcmU::EncodeCall(const int16_t* audio, | 133 size_t AudioEncoderPcmU::EncodeCall(const int16_t* audio, |
| 133 size_t input_len, | 134 size_t input_len, |
| 134 uint8_t* encoded) { | 135 uint8_t* encoded) { |
| 135 return WebRtcG711_EncodeU(audio, input_len, encoded); | 136 return WebRtcG711_EncodeU(audio, input_len, encoded); |
| 136 } | 137 } |
| 137 | 138 |
| 138 int AudioEncoderPcmU::BytesPerSample() const { | 139 size_t AudioEncoderPcmU::BytesPerSample() const { |
| 139 return 1; | 140 return 1; |
| 140 } | 141 } |
| 141 | 142 |
| 142 } // namespace webrtc | 143 } // namespace webrtc |
| OLD | NEW |