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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 } | 743 } |
744 | 744 |
745 /* Generate CRC if required. */ | 745 /* Generate CRC if required. */ |
746 if ((instISAC->bandwidthKHz != isac8kHz) && (streamLenUB > 0)) { | 746 if ((instISAC->bandwidthKHz != isac8kHz) && (streamLenUB > 0)) { |
747 uint32_t crc; | 747 uint32_t crc; |
748 | 748 |
749 WebRtcIsac_GetCrc((int16_t*)(&(encoded[streamLenLB + 1])), | 749 WebRtcIsac_GetCrc((int16_t*)(&(encoded[streamLenLB + 1])), |
750 streamLenUB + garbageLen, &crc); | 750 streamLenUB + garbageLen, &crc); |
751 #ifndef WEBRTC_ARCH_BIG_ENDIAN | 751 #ifndef WEBRTC_ARCH_BIG_ENDIAN |
752 for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) { | 752 for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) { |
753 encoded[streamLen - LEN_CHECK_SUM_WORD8 + k] = crc >> (24 - k * 8); | 753 encoded[streamLen - LEN_CHECK_SUM_WORD8 + k] = |
| 754 (uint8_t)(crc >> (24 - k * 8)); |
754 } | 755 } |
755 #else | 756 #else |
756 memcpy(&encoded[streamLenLB + streamLenUB + 1], &crc, LEN_CHECK_SUM_WORD8); | 757 memcpy(&encoded[streamLenLB + streamLenUB + 1], &crc, LEN_CHECK_SUM_WORD8); |
757 #endif | 758 #endif |
758 } | 759 } |
759 return streamLen; | 760 return streamLen; |
760 } | 761 } |
761 | 762 |
762 | 763 |
763 /****************************************************************************** | 764 /****************************************************************************** |
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2408 } | 2409 } |
2409 | 2410 |
2410 void WebRtcIsac_SetEncSampRateInDecoder(ISACStruct* inst, | 2411 void WebRtcIsac_SetEncSampRateInDecoder(ISACStruct* inst, |
2411 int sample_rate_hz) { | 2412 int sample_rate_hz) { |
2412 ISACMainStruct* instISAC = (ISACMainStruct*)inst; | 2413 ISACMainStruct* instISAC = (ISACMainStruct*)inst; |
2413 assert(instISAC->initFlag & BIT_MASK_DEC_INIT); | 2414 assert(instISAC->initFlag & BIT_MASK_DEC_INIT); |
2414 assert(!(instISAC->initFlag & BIT_MASK_ENC_INIT)); | 2415 assert(!(instISAC->initFlag & BIT_MASK_ENC_INIT)); |
2415 assert(sample_rate_hz == 16000 || sample_rate_hz == 32000); | 2416 assert(sample_rate_hz == 16000 || sample_rate_hz == 32000); |
2416 instISAC->encoderSamplingRateKHz = sample_rate_hz / 1000; | 2417 instISAC->encoderSamplingRateKHz = sample_rate_hz / 1000; |
2417 } | 2418 } |
OLD | NEW |