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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 364 } |
365 | 365 |
366 FileWrapper* inputStream = FileWrapper::Create(); | 366 FileWrapper* inputStream = FileWrapper::Create(); |
367 if(inputStream == NULL) | 367 if(inputStream == NULL) |
368 { | 368 { |
369 WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, | 369 WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, |
370 "Failed to allocate input stream for file %s", fileName); | 370 "Failed to allocate input stream for file %s", fileName); |
371 return -1; | 371 return -1; |
372 } | 372 } |
373 | 373 |
374 if(inputStream->OpenFile(fileName, true, loop) != 0) | 374 if (!inputStream->OpenFile(fileName, true)) { |
375 { | 375 delete inputStream; |
376 delete inputStream; | 376 WEBRTC_TRACE(kTraceError, kTraceFile, _id, "Could not open input file %s", |
377 WEBRTC_TRACE(kTraceError, kTraceFile, _id, | 377 fileName); |
378 "Could not open input file %s", fileName); | 378 return -1; |
379 return -1; | |
380 } | 379 } |
381 | 380 |
382 if(StartPlayingStream(*inputStream, loop, notificationTimeMs, | 381 if(StartPlayingStream(*inputStream, loop, notificationTimeMs, |
383 format, codecInst, startPointMs, stopPointMs) == -1) | 382 format, codecInst, startPointMs, stopPointMs) == -1) |
384 { | 383 { |
385 inputStream->CloseFile(); | 384 inputStream->CloseFile(); |
386 delete inputStream; | 385 delete inputStream; |
387 return -1; | 386 return -1; |
388 } | 387 } |
389 | 388 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 } | 740 } |
742 | 741 |
743 FileWrapper* outputStream = FileWrapper::Create(); | 742 FileWrapper* outputStream = FileWrapper::Create(); |
744 if(outputStream == NULL) | 743 if(outputStream == NULL) |
745 { | 744 { |
746 WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, | 745 WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, |
747 "Failed to allocate memory for output stream"); | 746 "Failed to allocate memory for output stream"); |
748 return -1; | 747 return -1; |
749 } | 748 } |
750 | 749 |
751 if(outputStream->OpenFile(fileName, false) != 0) | 750 if (!outputStream->OpenFile(fileName, false)) { |
752 { | 751 delete outputStream; |
753 delete outputStream; | 752 WEBRTC_TRACE(kTraceError, kTraceFile, _id, |
754 WEBRTC_TRACE(kTraceError, kTraceFile, _id, | 753 "Could not open output file '%s' for writing!", fileName); |
755 "Could not open output file '%s' for writing!", | 754 return -1; |
756 fileName); | |
757 return -1; | |
758 } | 755 } |
759 | 756 |
760 if(maxSizeBytes) | 757 if(maxSizeBytes) |
761 { | 758 { |
762 outputStream->SetMaxFileSize(maxSizeBytes); | 759 outputStream->SetMaxFileSize(maxSizeBytes); |
763 } | 760 } |
764 | 761 |
765 if(StartRecordingAudioStream(*outputStream, format, codecInst, | 762 if(StartRecordingAudioStream(*outputStream, format, codecInst, |
766 notificationTimeMs) == -1) | 763 notificationTimeMs) == -1) |
767 { | 764 { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 { | 1123 { |
1127 if((frequency == 8000) || (frequency == 16000)|| (frequency == 32000)) | 1124 if((frequency == 8000) || (frequency == 16000)|| (frequency == 32000)) |
1128 { | 1125 { |
1129 return true; | 1126 return true; |
1130 } | 1127 } |
1131 WEBRTC_TRACE(kTraceError, kTraceFile, -1, | 1128 WEBRTC_TRACE(kTraceError, kTraceFile, -1, |
1132 "Frequency should be 8000, 16000 or 32000 (Hz)"); | 1129 "Frequency should be 8000, 16000 or 32000 (Hz)"); |
1133 return false; | 1130 return false; |
1134 } | 1131 } |
1135 } // namespace webrtc | 1132 } // namespace webrtc |
OLD | NEW |