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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 first_timestamp_in_buffer_ = rtp_timestamp; | 191 first_timestamp_in_buffer_ = rtp_timestamp; |
192 input_buffer_.insert(input_buffer_.end(), audio, | 192 input_buffer_.insert(input_buffer_.end(), audio, |
193 audio + samples_per_10ms_frame_); | 193 audio + samples_per_10ms_frame_); |
194 if (input_buffer_.size() < (static_cast<size_t>(num_10ms_frames_per_packet_) * | 194 if (input_buffer_.size() < (static_cast<size_t>(num_10ms_frames_per_packet_) * |
195 samples_per_10ms_frame_)) { | 195 samples_per_10ms_frame_)) { |
196 return EncodedInfo(); | 196 return EncodedInfo(); |
197 } | 197 } |
198 CHECK_EQ(input_buffer_.size(), | 198 CHECK_EQ(input_buffer_.size(), |
199 static_cast<size_t>(num_10ms_frames_per_packet_) * | 199 static_cast<size_t>(num_10ms_frames_per_packet_) * |
200 samples_per_10ms_frame_); | 200 samples_per_10ms_frame_); |
201 int16_t status = WebRtcOpus_Encode( | 201 int status = WebRtcOpus_Encode( |
202 inst_, &input_buffer_[0], | 202 inst_, &input_buffer_[0], |
203 rtc::CheckedDivExact(CastInt16(input_buffer_.size()), | 203 rtc::CheckedDivExact(CastInt16(input_buffer_.size()), |
204 static_cast<int16_t>(num_channels_)), | 204 static_cast<int16_t>(num_channels_)), |
205 ClampInt16(max_encoded_bytes), encoded); | 205 ClampInt16(max_encoded_bytes), encoded); |
206 CHECK_GE(status, 0); // Fails only if fed invalid data. | 206 CHECK_GE(status, 0); // Fails only if fed invalid data. |
207 input_buffer_.clear(); | 207 input_buffer_.clear(); |
208 EncodedInfo info; | 208 EncodedInfo info; |
209 info.encoded_bytes = static_cast<size_t>(status); | 209 info.encoded_bytes = static_cast<size_t>(status); |
210 info.encoded_timestamp = first_timestamp_in_buffer_; | 210 info.encoded_timestamp = first_timestamp_in_buffer_; |
211 info.payload_type = payload_type_; | 211 info.payload_type = payload_type_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 return Reconstruct(conf); | 256 return Reconstruct(conf); |
257 } | 257 } |
258 | 258 |
259 bool AudioEncoderMutableOpus::SetMaxPlaybackRate(int frequency_hz) { | 259 bool AudioEncoderMutableOpus::SetMaxPlaybackRate(int frequency_hz) { |
260 auto conf = config(); | 260 auto conf = config(); |
261 conf.max_playback_rate_hz = frequency_hz; | 261 conf.max_playback_rate_hz = frequency_hz; |
262 return Reconstruct(conf); | 262 return Reconstruct(conf); |
263 } | 263 } |
264 | 264 |
265 } // namespace webrtc | 265 } // namespace webrtc |
OLD | NEW |