| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 iter != _audioList.end(); ++iter) { | 187 iter != _audioList.end(); ++iter) { |
| 188 delete *iter; | 188 delete *iter; |
| 189 } | 189 } |
| 190 _audioList.clear(); | 190 _audioList.clear(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 int32_t AudioTransportImpl::RecordedDataIsAvailable( | 193 int32_t AudioTransportImpl::RecordedDataIsAvailable( |
| 194 const void* audioSamples, | 194 const void* audioSamples, |
| 195 const size_t nSamples, | 195 const size_t nSamples, |
| 196 const size_t nBytesPerSample, | 196 const size_t nBytesPerSample, |
| 197 const uint8_t nChannels, | 197 const size_t nChannels, |
| 198 const uint32_t samplesPerSec, | 198 const uint32_t samplesPerSec, |
| 199 const uint32_t totalDelayMS, | 199 const uint32_t totalDelayMS, |
| 200 const int32_t clockDrift, | 200 const int32_t clockDrift, |
| 201 const uint32_t currentMicLevel, | 201 const uint32_t currentMicLevel, |
| 202 const bool keyPressed, | 202 const bool keyPressed, |
| 203 uint32_t& newMicLevel) | 203 uint32_t& newMicLevel) |
| 204 { | 204 { |
| 205 if (_fullDuplex && _audioList.size() < 15) | 205 if (_fullDuplex && _audioList.size() < 15) |
| 206 { | 206 { |
| 207 AudioPacket* packet = new AudioPacket(); | 207 AudioPacket* packet = new AudioPacket(); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 | 334 |
| 335 return 0; | 335 return 0; |
| 336 } | 336 } |
| 337 | 337 |
| 338 | 338 |
| 339 int32_t AudioTransportImpl::NeedMorePlayData( | 339 int32_t AudioTransportImpl::NeedMorePlayData( |
| 340 const size_t nSamples, | 340 const size_t nSamples, |
| 341 const size_t nBytesPerSample, | 341 const size_t nBytesPerSample, |
| 342 const uint8_t nChannels, | 342 const size_t nChannels, |
| 343 const uint32_t samplesPerSec, | 343 const uint32_t samplesPerSec, |
| 344 void* audioSamples, | 344 void* audioSamples, |
| 345 size_t& nSamplesOut, | 345 size_t& nSamplesOut, |
| 346 int64_t* elapsed_time_ms, | 346 int64_t* elapsed_time_ms, |
| 347 int64_t* ntp_time_ms) | 347 int64_t* ntp_time_ms) |
| 348 { | 348 { |
| 349 if (_fullDuplex) | 349 if (_fullDuplex) |
| 350 { | 350 { |
| 351 if (_audioList.empty()) | 351 if (_audioList.empty()) |
| 352 { | 352 { |
| 353 // use zero stuffing when not enough data | 353 // use zero stuffing when not enough data |
| 354 memset(audioSamples, 0, nBytesPerSample * nSamples); | 354 memset(audioSamples, 0, nBytesPerSample * nSamples); |
| 355 } else | 355 } else |
| 356 { | 356 { |
| 357 AudioPacket* packet = _audioList.front(); | 357 AudioPacket* packet = _audioList.front(); |
| 358 _audioList.pop_front(); | 358 _audioList.pop_front(); |
| 359 if (packet) | 359 if (packet) |
| 360 { | 360 { |
| 361 int ret(0); | 361 int ret(0); |
| 362 size_t lenOut(0); | 362 size_t lenOut(0); |
| 363 int16_t tmpBuf_96kHz[80 * 12]; | 363 int16_t tmpBuf_96kHz[80 * 12]; |
| 364 int16_t* ptr16In = NULL; | 364 int16_t* ptr16In = NULL; |
| 365 int16_t* ptr16Out = NULL; | 365 int16_t* ptr16Out = NULL; |
| 366 | 366 |
| 367 const size_t nSamplesIn = packet->nSamples; | 367 const size_t nSamplesIn = packet->nSamples; |
| 368 const uint8_t nChannelsIn = packet->nChannels; | 368 const size_t nChannelsIn = packet->nChannels; |
| 369 const uint32_t samplesPerSecIn = packet->samplesPerSec; | 369 const uint32_t samplesPerSecIn = packet->samplesPerSec; |
| 370 const size_t nBytesPerSampleIn = packet->nBytesPerSample; | 370 const size_t nBytesPerSampleIn = packet->nBytesPerSample; |
| 371 | 371 |
| 372 int32_t fsInHz(samplesPerSecIn); | 372 int32_t fsInHz(samplesPerSecIn); |
| 373 int32_t fsOutHz(samplesPerSec); | 373 int32_t fsOutHz(samplesPerSec); |
| 374 | 374 |
| 375 if (fsInHz == 44100) | 375 if (fsInHz == 44100) |
| 376 fsInHz = 44000; | 376 fsInHz = 44000; |
| 377 | 377 |
| 378 if (fsOutHz == 44100) | 378 if (fsOutHz == 44100) |
| (...skipping 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2738 | 2738 |
| 2739 TEST_LOG("\n"); | 2739 TEST_LOG("\n"); |
| 2740 PRINT_TEST_RESULTS; | 2740 PRINT_TEST_RESULTS; |
| 2741 | 2741 |
| 2742 return 0; | 2742 return 0; |
| 2743 } | 2743 } |
| 2744 | 2744 |
| 2745 } // namespace webrtc | 2745 } // namespace webrtc |
| 2746 | 2746 |
| 2747 // EOF | 2747 // EOF |
| OLD | NEW |