| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 return 0; | 243 return 0; |
| 244 } else { | 244 } else { |
| 245 return -1; | 245 return -1; |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 int WebRtcOpus_DecoderChannels(OpusDecInst* inst) { | 249 int WebRtcOpus_DecoderChannels(OpusDecInst* inst) { |
| 250 return inst->channels; | 250 return inst->channels; |
| 251 } | 251 } |
| 252 | 252 |
| 253 int16_t WebRtcOpus_DecoderInit(OpusDecInst* inst) { | 253 void WebRtcOpus_DecoderInit(OpusDecInst* inst) { |
| 254 int error = opus_decoder_ctl(inst->decoder, OPUS_RESET_STATE); | 254 opus_decoder_ctl(inst->decoder, OPUS_RESET_STATE); |
| 255 if (error == OPUS_OK) { | 255 inst->in_dtx_mode = 0; |
| 256 inst->in_dtx_mode = 0; | |
| 257 return 0; | |
| 258 } | |
| 259 return -1; | |
| 260 } | 256 } |
| 261 | 257 |
| 262 /* For decoder to determine if it is to output speech or comfort noise. */ | 258 /* For decoder to determine if it is to output speech or comfort noise. */ |
| 263 static int16_t DetermineAudioType(OpusDecInst* inst, size_t encoded_bytes) { | 259 static int16_t DetermineAudioType(OpusDecInst* inst, size_t encoded_bytes) { |
| 264 // Audio type becomes comfort noise if |encoded_byte| is 1 and keeps | 260 // Audio type becomes comfort noise if |encoded_byte| is 1 and keeps |
| 265 // to be so if the following |encoded_byte| are 0 or 1. | 261 // to be so if the following |encoded_byte| are 0 or 1. |
| 266 if (encoded_bytes == 0 && inst->in_dtx_mode) { | 262 if (encoded_bytes == 0 && inst->in_dtx_mode) { |
| 267 return 2; // Comfort noise. | 263 return 2; // Comfort noise. |
| 268 } else if (encoded_bytes == 1) { | 264 } else if (encoded_bytes == 1) { |
| 269 inst->in_dtx_mode = 1; | 265 inst->in_dtx_mode = 1; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 return 0; | 437 return 0; |
| 442 } | 438 } |
| 443 | 439 |
| 444 for (n = 0; n < channels; n++) { | 440 for (n = 0; n < channels; n++) { |
| 445 if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1))) | 441 if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1))) |
| 446 return 1; | 442 return 1; |
| 447 } | 443 } |
| 448 | 444 |
| 449 return 0; | 445 return 0; |
| 450 } | 446 } |
| OLD | NEW |