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 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 } | 1821 } |
1822 | 1822 |
1823 void stereoDeInterleave(int16_t* audioSamples, size_t numSamples) { | 1823 void stereoDeInterleave(int16_t* audioSamples, size_t numSamples) { |
1824 int16_t* tempVec; | 1824 int16_t* tempVec; |
1825 int16_t* readPtr, *writeL, *writeR; | 1825 int16_t* readPtr, *writeL, *writeR; |
1826 | 1826 |
1827 if (numSamples == 0) | 1827 if (numSamples == 0) |
1828 return; | 1828 return; |
1829 | 1829 |
1830 tempVec = (int16_t*)malloc(sizeof(int16_t) * numSamples); | 1830 tempVec = (int16_t*)malloc(sizeof(int16_t) * numSamples); |
1831 if (tempVec == NULL) { | 1831 if (tempVec == nullptr) { |
1832 printf("Error allocating memory\n"); | 1832 printf("Error allocating memory\n"); |
1833 exit(0); | 1833 exit(0); |
1834 } | 1834 } |
1835 | 1835 |
1836 memcpy(tempVec, audioSamples, numSamples * sizeof(int16_t)); | 1836 memcpy(tempVec, audioSamples, numSamples * sizeof(int16_t)); |
1837 | 1837 |
1838 writeL = audioSamples; | 1838 writeL = audioSamples; |
1839 writeR = &audioSamples[numSamples / 2]; | 1839 writeR = &audioSamples[numSamples / 2]; |
1840 readPtr = tempVec; | 1840 readPtr = tempVec; |
1841 | 1841 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 memmove(ptrL + stride, ptrL, ptrR - ptrL); | 1876 memmove(ptrL + stride, ptrL, ptrR - ptrL); |
1877 | 1877 |
1878 // copy from temp to left pointer | 1878 // copy from temp to left pointer |
1879 memcpy(ptrL, temp, stride); | 1879 memcpy(ptrL, temp, stride); |
1880 | 1880 |
1881 // advance pointers | 1881 // advance pointers |
1882 ptrL += stride * 2; | 1882 ptrL += stride * 2; |
1883 ptrR += stride; | 1883 ptrR += stride; |
1884 } | 1884 } |
1885 } | 1885 } |
OLD | NEW |