Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: webrtc/modules/audio_device/audio_device_buffer.cc

Issue 2054373002: FileWrapper[Impl] modifications and actually remove the "Impl" class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix use of ASSERT instead of ASSERT_TRUE in test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/common_types.cc ('k') | webrtc/modules/audio_device/dummy/file_audio_device.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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) ? 0 : -1;
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
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) ? 0 : -1;
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
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 // write to binary file in mono or stereo (interleaved)
429 // write to binary file in mono or stereo (interleaved) 429 _recFile.Write(&_recBuffer[0], _recSize);
430 _recFile.Write(&_recBuffer[0], _recSize);
431 } 430 }
432 431
433 return 0; 432 return 0;
434 } 433 }
435 434
436 // ---------------------------------------------------------------------------- 435 // ----------------------------------------------------------------------------
437 // DeliverRecordedData 436 // DeliverRecordedData
438 // ---------------------------------------------------------------------------- 437 // ----------------------------------------------------------------------------
439 438
440 int32_t AudioDeviceBuffer::DeliverRecordedData() 439 int32_t AudioDeviceBuffer::DeliverRecordedData()
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 { 564 {
566 WEBRTC_TRACE(kTraceError, kTraceUtility, _id, 565 WEBRTC_TRACE(kTraceError, kTraceUtility, _id,
567 "_playSize %" PRIuS " exceeds kMaxBufferSizeBytes in " 566 "_playSize %" PRIuS " exceeds kMaxBufferSizeBytes in "
568 "AudioDeviceBuffer::GetPlayoutData", _playSize); 567 "AudioDeviceBuffer::GetPlayoutData", _playSize);
569 assert(false); 568 assert(false);
570 return -1; 569 return -1;
571 } 570 }
572 571
573 memcpy(audioBuffer, &_playBuffer[0], _playSize); 572 memcpy(audioBuffer, &_playBuffer[0], _playSize);
574 573
575 if (_playFile.Open()) 574 if (_playFile.is_open()) {
576 { 575 // write to binary file in mono or stereo (interleaved)
577 // write to binary file in mono or stereo (interleaved) 576 _playFile.Write(&_playBuffer[0], _playSize);
578 _playFile.Write(&_playBuffer[0], _playSize);
579 } 577 }
580 578
581 return static_cast<int32_t>(_playSamples); 579 return static_cast<int32_t>(_playSamples);
582 } 580 }
583 581
584 } // namespace webrtc 582 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_types.cc ('k') | webrtc/modules/audio_device/dummy/file_audio_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698