Chromium Code Reviews| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 } | 399 } |
| 400 | 400 |
| 401 _recSamples = nSamples; | 401 _recSamples = nSamples; |
| 402 _recSize = _recBytesPerSample*nSamples; // {2,4}*nSamples | 402 _recSize = _recBytesPerSample*nSamples; // {2,4}*nSamples |
| 403 if (_recSize > kMaxBufferSizeBytes) | 403 if (_recSize > kMaxBufferSizeBytes) |
| 404 { | 404 { |
| 405 assert(false); | 405 assert(false); |
| 406 return -1; | 406 return -1; |
| 407 } | 407 } |
| 408 | 408 |
| 409 if (nSamples != _recSamples) | |
|
henrika_webrtc
2015/06/10 08:11:35
Not sure why these lines are removed. Care to elab
Peter Kasting
2015/06/11 04:31:41
On line 401 above we unconditionally set |_recSamp
| |
| 410 { | |
| 411 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, "invalid number of r ecorded samples (%d)", nSamples); | |
| 412 return -1; | |
| 413 } | |
| 414 | |
| 415 if (_recChannel == AudioDeviceModule::kChannelBoth) | 409 if (_recChannel == AudioDeviceModule::kChannelBoth) |
| 416 { | 410 { |
| 417 // (default) copy the complete input buffer to the local buffer | 411 // (default) copy the complete input buffer to the local buffer |
| 418 memcpy(&_recBuffer[0], audioBuffer, _recSize); | 412 memcpy(&_recBuffer[0], audioBuffer, _recSize); |
| 419 } | 413 } |
| 420 else | 414 else |
| 421 { | 415 { |
| 422 int16_t* ptr16In = (int16_t*)audioBuffer; | 416 int16_t* ptr16In = (int16_t*)audioBuffer; |
| 423 int16_t* ptr16Out = (int16_t*)&_recBuffer[0]; | 417 int16_t* ptr16Out = (int16_t*)&_recBuffer[0]; |
| 424 | 418 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 569 // ---------------------------------------------------------------------------- | 563 // ---------------------------------------------------------------------------- |
| 570 // GetPlayoutData | 564 // GetPlayoutData |
| 571 // ---------------------------------------------------------------------------- | 565 // ---------------------------------------------------------------------------- |
| 572 | 566 |
| 573 int32_t AudioDeviceBuffer::GetPlayoutData(void* audioBuffer) | 567 int32_t AudioDeviceBuffer::GetPlayoutData(void* audioBuffer) |
| 574 { | 568 { |
| 575 CriticalSectionScoped lock(&_critSect); | 569 CriticalSectionScoped lock(&_critSect); |
| 576 | 570 |
| 577 if (_playSize > kMaxBufferSizeBytes) | 571 if (_playSize > kMaxBufferSizeBytes) |
| 578 { | 572 { |
| 579 WEBRTC_TRACE(kTraceError, kTraceUtility, _id, "_playSize %i exceeds " | 573 WEBRTC_TRACE(kTraceError, kTraceUtility, _id, |
| 580 "kMaxBufferSizeBytes in AudioDeviceBuffer::GetPlayoutData", _playSize); | 574 "_playSize %i exceeds kMaxBufferSizeBytes in " |
| 575 "AudioDeviceBuffer::GetPlayoutData", _playSize); | |
| 581 assert(false); | 576 assert(false); |
| 582 return -1; | 577 return -1; |
| 583 } | 578 } |
| 584 | 579 |
| 585 memcpy(audioBuffer, &_playBuffer[0], _playSize); | 580 memcpy(audioBuffer, &_playBuffer[0], _playSize); |
| 586 | 581 |
| 587 if (_playFile.Open()) | 582 if (_playFile.Open()) |
| 588 { | 583 { |
| 589 // write to binary file in mono or stereo (interleaved) | 584 // write to binary file in mono or stereo (interleaved) |
| 590 _playFile.Write(&_playBuffer[0], _playSize); | 585 _playFile.Write(&_playBuffer[0], _playSize); |
| 591 } | 586 } |
| 592 | 587 |
| 593 return _playSamples; | 588 return _playSamples; |
| 594 } | 589 } |
| 595 | 590 |
| 596 } // namespace webrtc | 591 } // namespace webrtc |
| OLD | NEW |