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

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

Issue 2158293003: Update tests and DTX check for Opus 1.1.3. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add expected result on Android arm64 to Opus bitrate test Created 4 years, 4 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (samples > 48 * kWebRtcOpusMaxEncodeFrameSizeMs) { 88 if (samples > 48 * kWebRtcOpusMaxEncodeFrameSizeMs) {
89 return -1; 89 return -1;
90 } 90 }
91 91
92 res = opus_encode(inst->encoder, 92 res = opus_encode(inst->encoder,
93 (const opus_int16*)audio_in, 93 (const opus_int16*)audio_in,
94 (int)samples, 94 (int)samples,
95 encoded, 95 encoded,
96 (opus_int32)length_encoded_buffer); 96 (opus_int32)length_encoded_buffer);
97 97
98 if (res == 1) { 98 if (res <= 0) {
99 return -1;
100 }
101
102 if (res <= 2) {
99 // Indicates DTX since the packet has nothing but a header. In principle, 103 // Indicates DTX since the packet has nothing but a header. In principle,
100 // there is no need to send this packet. However, we do transmit the first 104 // there is no need to send this packet. However, we do transmit the first
101 // occurrence to let the decoder know that the encoder enters DTX mode. 105 // occurrence to let the decoder know that the encoder enters DTX mode.
102 if (inst->in_dtx_mode) { 106 if (inst->in_dtx_mode) {
103 return 0; 107 return 0;
104 } else { 108 } else {
105 inst->in_dtx_mode = 1; 109 inst->in_dtx_mode = 1;
106 return 1; 110 return 1;
107 } 111 }
108 } else if (res > 1) {
109 inst->in_dtx_mode = 0;
110 return res;
111 } 112 }
112 113
113 return -1; 114 inst->in_dtx_mode = 0;
115 return res;
114 } 116 }
115 117
116 int16_t WebRtcOpus_SetBitRate(OpusEncInst* inst, int32_t rate) { 118 int16_t WebRtcOpus_SetBitRate(OpusEncInst* inst, int32_t rate) {
117 if (inst) { 119 if (inst) {
118 return opus_encoder_ctl(inst->encoder, OPUS_SET_BITRATE(rate)); 120 return opus_encoder_ctl(inst->encoder, OPUS_SET_BITRATE(rate));
119 } else { 121 } else {
120 return -1; 122 return -1;
121 } 123 }
122 } 124 }
123 125
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 return 0; 454 return 0;
453 } 455 }
454 456
455 for (n = 0; n < channels; n++) { 457 for (n = 0; n < channels; n++) {
456 if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1))) 458 if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1)))
457 return 1; 459 return 1;
458 } 460 }
459 461
460 return 0; 462 return 0;
461 } 463 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698