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

Side by Side Diff: webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc

Issue 1967503002: Audio codec usage statistics (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 RTC_DCHECK_EQ(encoded_bytes, RequiredOutputSizeBytes()); 124 RTC_DCHECK_EQ(encoded_bytes, RequiredOutputSizeBytes());
125 125
126 EncodedInfo info; 126 EncodedInfo info;
127 info.encoded_bytes = encoded_bytes; 127 info.encoded_bytes = encoded_bytes;
128 info.encoded_timestamp = first_timestamp_in_buffer_; 128 info.encoded_timestamp = first_timestamp_in_buffer_;
129 info.payload_type = config_.payload_type; 129 info.payload_type = config_.payload_type;
130 return info; 130 return info;
131 } 131 }
132 132
133 const char* AudioEncoderIlbc::GetCodecName() const {
134 return "iLBC";
135 }
136
133 void AudioEncoderIlbc::Reset() { 137 void AudioEncoderIlbc::Reset() {
134 if (encoder_) 138 if (encoder_)
135 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderFree(encoder_)); 139 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderFree(encoder_));
136 RTC_CHECK(config_.IsOk()); 140 RTC_CHECK(config_.IsOk());
137 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderCreate(&encoder_)); 141 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderCreate(&encoder_));
138 const int encoder_frame_size_ms = config_.frame_size_ms > 30 142 const int encoder_frame_size_ms = config_.frame_size_ms > 30
139 ? config_.frame_size_ms / 2 143 ? config_.frame_size_ms / 2
140 : config_.frame_size_ms; 144 : config_.frame_size_ms;
141 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderInit(encoder_, encoder_frame_size_ms)); 145 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderInit(encoder_, encoder_frame_size_ms));
142 num_10ms_frames_buffered_ = 0; 146 num_10ms_frames_buffered_ = 0;
143 } 147 }
144 148
145 size_t AudioEncoderIlbc::RequiredOutputSizeBytes() const { 149 size_t AudioEncoderIlbc::RequiredOutputSizeBytes() const {
146 switch (num_10ms_frames_per_packet_) { 150 switch (num_10ms_frames_per_packet_) {
147 case 2: return 38; 151 case 2: return 38;
148 case 3: return 50; 152 case 3: return 50;
149 case 4: return 2 * 38; 153 case 4: return 2 * 38;
150 case 6: return 2 * 50; 154 case 6: return 2 * 50;
151 default: FATAL(); 155 default: FATAL();
152 } 156 }
153 } 157 }
154 158
155 } // namespace webrtc 159 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698