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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 size_t AudioEncoderCng::Max10MsFramesInAPacket() const { | 92 size_t AudioEncoderCng::Max10MsFramesInAPacket() const { |
93 return speech_encoder_->Max10MsFramesInAPacket(); | 93 return speech_encoder_->Max10MsFramesInAPacket(); |
94 } | 94 } |
95 | 95 |
96 int AudioEncoderCng::GetTargetBitrate() const { | 96 int AudioEncoderCng::GetTargetBitrate() const { |
97 return speech_encoder_->GetTargetBitrate(); | 97 return speech_encoder_->GetTargetBitrate(); |
98 } | 98 } |
99 | 99 |
100 AudioEncoder::EncodedInfo AudioEncoderCng::EncodeInternal( | 100 AudioEncoder::EncodedInfo AudioEncoderCng::EncodeImpl( |
101 uint32_t rtp_timestamp, | 101 uint32_t rtp_timestamp, |
102 rtc::ArrayView<const int16_t> audio, | 102 rtc::ArrayView<const int16_t> audio, |
103 rtc::Buffer* encoded) { | 103 rtc::Buffer* encoded) { |
104 const size_t samples_per_10ms_frame = SamplesPer10msFrame(); | 104 const size_t samples_per_10ms_frame = SamplesPer10msFrame(); |
105 RTC_CHECK_EQ(speech_buffer_.size(), | 105 RTC_CHECK_EQ(speech_buffer_.size(), |
106 rtp_timestamps_.size() * samples_per_10ms_frame); | 106 rtp_timestamps_.size() * samples_per_10ms_frame); |
107 rtp_timestamps_.push_back(rtp_timestamp); | 107 rtp_timestamps_.push_back(rtp_timestamp); |
108 RTC_DCHECK_EQ(samples_per_10ms_frame, audio.size()); | 108 RTC_DCHECK_EQ(samples_per_10ms_frame, audio.size()); |
109 speech_buffer_.insert(speech_buffer_.end(), audio.cbegin(), audio.cend()); | 109 speech_buffer_.insert(speech_buffer_.end(), audio.cbegin(), audio.cend()); |
110 const size_t frames_to_encode = speech_encoder_->Num10MsFramesInNextPacket(); | 110 const size_t frames_to_encode = speech_encoder_->Num10MsFramesInNextPacket(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 } | 260 } |
261 return info; | 261 return info; |
262 } | 262 } |
263 | 263 |
264 size_t AudioEncoderCng::SamplesPer10msFrame() const { | 264 size_t AudioEncoderCng::SamplesPer10msFrame() const { |
265 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); | 265 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); |
266 } | 266 } |
267 | 267 |
268 } // namespace webrtc | 268 } // namespace webrtc |
OLD | NEW |