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

Side by Side Diff: webrtc/modules/audio_coding/codecs/opus/opus_interface.c

Issue 2772773002: Adding cbr support for Opus (Closed)
Patch Set: Reverted everything but audio_encoder_opus and opus_interface Created 3 years, 8 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 int ret = opus_encoder_ctl(inst->encoder, 198 int ret = opus_encoder_ctl(inst->encoder,
199 OPUS_SET_SIGNAL(OPUS_AUTO)); 199 OPUS_SET_SIGNAL(OPUS_AUTO));
200 if (ret != OPUS_OK) 200 if (ret != OPUS_OK)
201 return ret; 201 return ret;
202 return opus_encoder_ctl(inst->encoder, OPUS_SET_DTX(0)); 202 return opus_encoder_ctl(inst->encoder, OPUS_SET_DTX(0));
203 } else { 203 } else {
204 return -1; 204 return -1;
205 } 205 }
206 } 206 }
207 207
208 int16_t WebRtcOpus_EnableCbr(OpusEncInst* inst) {
209 if (inst) {
210 return opus_encoder_ctl(inst->encoder, OPUS_SET_VBR(0));
211 } else {
212 return -1;
213 }
214 }
215
216 int16_t WebRtcOpus_DisableCbr(OpusEncInst* inst) {
217 if (inst) {
218 return opus_encoder_ctl(inst->encoder, OPUS_SET_VBR(1));
219 } else {
220 return -1;
221 }
222 }
223
208 int16_t WebRtcOpus_SetComplexity(OpusEncInst* inst, int32_t complexity) { 224 int16_t WebRtcOpus_SetComplexity(OpusEncInst* inst, int32_t complexity) {
209 if (inst) { 225 if (inst) {
210 return opus_encoder_ctl(inst->encoder, OPUS_SET_COMPLEXITY(complexity)); 226 return opus_encoder_ctl(inst->encoder, OPUS_SET_COMPLEXITY(complexity));
211 } else { 227 } else {
212 return -1; 228 return -1;
213 } 229 }
214 } 230 }
215 231
216 int16_t WebRtcOpus_SetForceChannels(OpusEncInst* inst, size_t num_channels) { 232 int16_t WebRtcOpus_SetForceChannels(OpusEncInst* inst, size_t num_channels) {
217 if (!inst) 233 if (!inst)
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 return 0; 494 return 0;
479 } 495 }
480 496
481 for (n = 0; n < channels; n++) { 497 for (n = 0; n < channels; n++) {
482 if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1))) 498 if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1)))
483 return 1; 499 return 1;
484 } 500 }
485 501
486 return 0; 502 return 0;
487 } 503 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/opus/opus_interface.h ('k') | webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698