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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 const size_t samples_per_10ms_frame = SamplesPer10msFrame(); | 233 const size_t samples_per_10ms_frame = SamplesPer10msFrame(); |
234 AudioEncoder::EncodedInfo info; | 234 AudioEncoder::EncodedInfo info; |
235 for (size_t i = 0; i < frames_to_encode; ++i) { | 235 for (size_t i = 0; i < frames_to_encode; ++i) { |
236 info = | 236 info = |
237 speech_encoder_->Encode(rtp_timestamps_.front(), | 237 speech_encoder_->Encode(rtp_timestamps_.front(), |
238 rtc::ArrayView<const int16_t>( | 238 rtc::ArrayView<const int16_t>( |
239 &speech_buffer_[i * samples_per_10ms_frame], | 239 &speech_buffer_[i * samples_per_10ms_frame], |
240 samples_per_10ms_frame), | 240 samples_per_10ms_frame), |
241 encoded); | 241 encoded); |
242 if (i + 1 == frames_to_encode) { | 242 if (i + 1 == frames_to_encode) { |
243 RTC_CHECK_GT(info.encoded_bytes, 0u) << "Encoder didn't deliver data."; | 243 RTC_CHECK_GT(info.encoded_bytes, 0) << "Encoder didn't deliver data."; |
244 } else { | 244 } else { |
245 RTC_CHECK_EQ(info.encoded_bytes, 0u) | 245 RTC_CHECK_EQ(info.encoded_bytes, 0) |
246 << "Encoder delivered data too early."; | 246 << "Encoder delivered data too early."; |
247 } | 247 } |
248 } | 248 } |
249 return info; | 249 return info; |
250 } | 250 } |
251 | 251 |
252 size_t AudioEncoderCng::SamplesPer10msFrame() const { | 252 size_t AudioEncoderCng::SamplesPer10msFrame() const { |
253 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); | 253 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); |
254 } | 254 } |
255 | 255 |
256 } // namespace webrtc | 256 } // namespace webrtc |
OLD | NEW |