OLD | NEW |
---|---|
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 Loading... | |
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 <= 2) { |
minyue-webrtc
2016/07/26 10:24:42
Should it be the following
if (res == 0)
return
flim-webrtc
2016/07/26 11:40:41
Good catch. I've used res <= 0 since Opus may retu
minyue-webrtc
2016/07/26 11:52:06
Good catch :P
| |
99 // Indicates DTX since the packet has nothing but a header. In principle, | 99 // 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 | 100 // 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. | 101 // occurrence to let the decoder know that the encoder enters DTX mode. |
102 if (inst->in_dtx_mode) { | 102 if (inst->in_dtx_mode) { |
103 return 0; | 103 return 0; |
104 } else { | 104 } else { |
105 inst->in_dtx_mode = 1; | 105 inst->in_dtx_mode = 1; |
106 return 1; | 106 return 1; |
107 } | 107 } |
108 } else if (res > 1) { | 108 } else if (res > 1) { |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 return 0; | 452 return 0; |
453 } | 453 } |
454 | 454 |
455 for (n = 0; n < channels; n++) { | 455 for (n = 0; n < channels; n++) { |
456 if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1))) | 456 if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1))) |
457 return 1; | 457 return 1; |
458 } | 458 } |
459 | 459 |
460 return 0; | 460 return 0; |
461 } | 461 } |
OLD | NEW |