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

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

Issue 1967503002: Audio codec usage statistics (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Hopefully last version, minimal changes. Created 4 years, 7 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 RTC_CHECK_GE(status, 0); // Fails only if fed invalid data. 205 RTC_CHECK_GE(status, 0); // Fails only if fed invalid data.
206 206
207 return static_cast<size_t>(status); 207 return static_cast<size_t>(status);
208 }); 208 });
209 input_buffer_.clear(); 209 input_buffer_.clear();
210 210
211 info.encoded_timestamp = first_timestamp_in_buffer_; 211 info.encoded_timestamp = first_timestamp_in_buffer_;
212 info.payload_type = config_.payload_type; 212 info.payload_type = config_.payload_type;
213 info.send_even_if_empty = true; // Allows Opus to send empty packets. 213 info.send_even_if_empty = true; // Allows Opus to send empty packets.
214 info.speech = (info.encoded_bytes > 0); 214 info.speech = (info.encoded_bytes > 0);
215 info.encoder_type = AudioEncoder::CodecType::kOpus;
kwiberg-webrtc 2016/05/16 08:13:26 And here.
aleloi 2016/05/16 08:20:49 Done.
215 return info; 216 return info;
216 } 217 }
217 218
218 size_t AudioEncoderOpus::Num10msFramesPerPacket() const { 219 size_t AudioEncoderOpus::Num10msFramesPerPacket() const {
219 return static_cast<size_t>(rtc::CheckedDivExact(config_.frame_size_ms, 10)); 220 return static_cast<size_t>(rtc::CheckedDivExact(config_.frame_size_ms, 10));
220 } 221 }
221 222
222 size_t AudioEncoderOpus::SamplesPer10msFrame() const { 223 size_t AudioEncoderOpus::SamplesPer10msFrame() const {
223 return rtc::CheckedDivExact(kSampleRateHz, 100) * config_.num_channels; 224 return rtc::CheckedDivExact(kSampleRateHz, 100) * config_.num_channels;
224 } 225 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 RTC_CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_)); 261 RTC_CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_));
261 } 262 }
262 RTC_CHECK_EQ(0, 263 RTC_CHECK_EQ(0,
263 WebRtcOpus_SetPacketLossRate( 264 WebRtcOpus_SetPacketLossRate(
264 inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5))); 265 inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5)));
265 config_ = config; 266 config_ = config;
266 return true; 267 return true;
267 } 268 }
268 269
269 } // namespace webrtc 270 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698