Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc

Issue 1179953003: Revert "Upconvert various types to int." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 int status = WebRtcOpus_Encode( 201 int16_t 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 = status; 209 info.encoded_bytes = 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698