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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 int32_t AudioDeviceBuffer::StartInputFileRecording( | 306 int32_t AudioDeviceBuffer::StartInputFileRecording( |
307 const char fileName[kAdmMaxFileNameSize]) | 307 const char fileName[kAdmMaxFileNameSize]) |
308 { | 308 { |
309 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 309 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); |
310 | 310 |
311 CriticalSectionScoped lock(&_critSect); | 311 CriticalSectionScoped lock(&_critSect); |
312 | 312 |
313 _recFile.Flush(); | 313 _recFile.Flush(); |
314 _recFile.CloseFile(); | 314 _recFile.CloseFile(); |
315 | 315 |
316 return (_recFile.OpenFile(fileName, false, false, false)); | 316 return (_recFile.OpenFile(fileName, false)); |
317 } | 317 } |
318 | 318 |
319 // ---------------------------------------------------------------------------- | 319 // ---------------------------------------------------------------------------- |
320 // StopInputFileRecording | 320 // StopInputFileRecording |
321 // ---------------------------------------------------------------------------- | 321 // ---------------------------------------------------------------------------- |
322 | 322 |
323 int32_t AudioDeviceBuffer::StopInputFileRecording() | 323 int32_t AudioDeviceBuffer::StopInputFileRecording() |
324 { | 324 { |
325 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 325 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); |
326 | 326 |
(...skipping 12 matching lines...) Expand all Loading... |
339 int32_t AudioDeviceBuffer::StartOutputFileRecording( | 339 int32_t AudioDeviceBuffer::StartOutputFileRecording( |
340 const char fileName[kAdmMaxFileNameSize]) | 340 const char fileName[kAdmMaxFileNameSize]) |
341 { | 341 { |
342 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 342 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); |
343 | 343 |
344 CriticalSectionScoped lock(&_critSect); | 344 CriticalSectionScoped lock(&_critSect); |
345 | 345 |
346 _playFile.Flush(); | 346 _playFile.Flush(); |
347 _playFile.CloseFile(); | 347 _playFile.CloseFile(); |
348 | 348 |
349 return (_playFile.OpenFile(fileName, false, false, false)); | 349 return (_playFile.OpenFile(fileName, false)); |
350 } | 350 } |
351 | 351 |
352 // ---------------------------------------------------------------------------- | 352 // ---------------------------------------------------------------------------- |
353 // StopOutputFileRecording | 353 // StopOutputFileRecording |
354 // ---------------------------------------------------------------------------- | 354 // ---------------------------------------------------------------------------- |
355 | 355 |
356 int32_t AudioDeviceBuffer::StopOutputFileRecording() | 356 int32_t AudioDeviceBuffer::StopOutputFileRecording() |
357 { | 357 { |
358 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 358 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); |
359 | 359 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // exctract left or right channel from input buffer to the local buffer | 417 // exctract left or right channel from input buffer to the local buffer |
418 for (size_t i = 0; i < _recSamples; i++) | 418 for (size_t i = 0; i < _recSamples; i++) |
419 { | 419 { |
420 *ptr16Out = *ptr16In; | 420 *ptr16Out = *ptr16In; |
421 ptr16Out++; | 421 ptr16Out++; |
422 ptr16In++; | 422 ptr16In++; |
423 ptr16In++; | 423 ptr16In++; |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 if (_recFile.Open()) | 427 if (_recFile.is_open()) |
428 { | 428 { |
429 // write to binary file in mono or stereo (interleaved) | 429 // write to binary file in mono or stereo (interleaved) |
430 _recFile.Write(&_recBuffer[0], _recSize); | 430 _recFile.Write(&_recBuffer[0], _recSize); |
431 } | 431 } |
432 | 432 |
433 return 0; | 433 return 0; |
434 } | 434 } |
435 | 435 |
436 // ---------------------------------------------------------------------------- | 436 // ---------------------------------------------------------------------------- |
437 // DeliverRecordedData | 437 // DeliverRecordedData |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 { | 565 { |
566 WEBRTC_TRACE(kTraceError, kTraceUtility, _id, | 566 WEBRTC_TRACE(kTraceError, kTraceUtility, _id, |
567 "_playSize %" PRIuS " exceeds kMaxBufferSizeBytes in " | 567 "_playSize %" PRIuS " exceeds kMaxBufferSizeBytes in " |
568 "AudioDeviceBuffer::GetPlayoutData", _playSize); | 568 "AudioDeviceBuffer::GetPlayoutData", _playSize); |
569 assert(false); | 569 assert(false); |
570 return -1; | 570 return -1; |
571 } | 571 } |
572 | 572 |
573 memcpy(audioBuffer, &_playBuffer[0], _playSize); | 573 memcpy(audioBuffer, &_playBuffer[0], _playSize); |
574 | 574 |
575 if (_playFile.Open()) | 575 if (_playFile.is_open()) |
576 { | 576 { |
577 // write to binary file in mono or stereo (interleaved) | 577 // write to binary file in mono or stereo (interleaved) |
578 _playFile.Write(&_playBuffer[0], _playSize); | 578 _playFile.Write(&_playBuffer[0], _playSize); |
579 } | 579 } |
580 | 580 |
581 return static_cast<int32_t>(_playSamples); | 581 return static_cast<int32_t>(_playSamples); |
582 } | 582 } |
583 | 583 |
584 } // namespace webrtc | 584 } // namespace webrtc |
OLD | NEW |