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

Side by Side Diff: webrtc/modules/audio_device/dummy/file_audio_device_factory.cc

Issue 1965063003: Revert of Remove webrtc/base/scoped_ptr.h (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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
11 #include "webrtc/modules/audio_device/dummy/file_audio_device_factory.h" 11 #include "webrtc/modules/audio_device/dummy/file_audio_device_factory.h"
12 12
13 #include <cstdlib>
14 #include <cstring> 13 #include <cstring>
15 14
16 #include "webrtc/modules/audio_device/dummy/file_audio_device.h" 15 #include "webrtc/modules/audio_device/dummy/file_audio_device.h"
17 16
18 namespace webrtc { 17 namespace webrtc {
19 18
20 bool FileAudioDeviceFactory::_isConfigured = false; 19 bool FileAudioDeviceFactory::_isConfigured = false;
21 char FileAudioDeviceFactory::_inputAudioFilename[MAX_FILENAME_LEN] = ""; 20 char FileAudioDeviceFactory::_inputAudioFilename[MAX_FILENAME_LEN] = "";
22 char FileAudioDeviceFactory::_outputAudioFilename[MAX_FILENAME_LEN] = ""; 21 char FileAudioDeviceFactory::_outputAudioFilename[MAX_FILENAME_LEN] = "";
23 22
24 FileAudioDevice* FileAudioDeviceFactory::CreateFileAudioDevice( 23 FileAudioDevice* FileAudioDeviceFactory::CreateFileAudioDevice(
25 const int32_t id) { 24 const int32_t id) {
26 // Bail out here if the files haven't been set explicitly. 25 // Bail out here if the files haven't been set explicitly.
27 if (!_isConfigured) { 26 if (!_isConfigured) {
28 printf("Was compiled with WEBRTC_DUMMY_AUDIO_PLAY_STATIC_FILE " 27 printf("Was compiled with WEBRTC_DUMMY_AUDIO_PLAY_STATIC_FILE "
29 "but did not set input/output files to use. Bailing out.\n"); 28 "but did not set input/output files to use. Bailing out.\n");
30 std::exit(1); 29 exit(1);
31 } 30 }
32 return new FileAudioDevice(id, _inputAudioFilename, _outputAudioFilename); 31 return new FileAudioDevice(id, _inputAudioFilename, _outputAudioFilename);
33 } 32 }
34 33
35 void FileAudioDeviceFactory::SetFilenamesToUse( 34 void FileAudioDeviceFactory::SetFilenamesToUse(
36 const char* inputAudioFilename, const char* outputAudioFilename) { 35 const char* inputAudioFilename, const char* outputAudioFilename) {
37 #ifdef WEBRTC_DUMMY_FILE_DEVICES 36 #ifdef WEBRTC_DUMMY_FILE_DEVICES
38 assert(strlen(inputAudioFilename) < MAX_FILENAME_LEN && 37 assert(strlen(inputAudioFilename) < MAX_FILENAME_LEN &&
39 strlen(outputAudioFilename) < MAX_FILENAME_LEN); 38 strlen(outputAudioFilename) < MAX_FILENAME_LEN);
40 39
41 // Copy the strings since we don't know the lifetime of the input pointers. 40 // Copy the strings since we don't know the lifetime of the input pointers.
42 strncpy(_inputAudioFilename, inputAudioFilename, MAX_FILENAME_LEN); 41 strncpy(_inputAudioFilename, inputAudioFilename, MAX_FILENAME_LEN);
43 strncpy(_outputAudioFilename, outputAudioFilename, MAX_FILENAME_LEN); 42 strncpy(_outputAudioFilename, outputAudioFilename, MAX_FILENAME_LEN);
44 _isConfigured = true; 43 _isConfigured = true;
45 #else 44 #else
46 // Sanity: must be compiled with the right define to run this. 45 // Sanity: must be compiled with the right define to run this.
47 printf("Trying to use dummy file devices, but is not compiled " 46 printf("Trying to use dummy file devices, but is not compiled "
48 "with WEBRTC_DUMMY_FILE_DEVICES. Bailing out.\n"); 47 "with WEBRTC_DUMMY_FILE_DEVICES. Bailing out.\n");
49 std::exit(1); 48 exit(1);
50 #endif 49 #endif
51 } 50 }
52 51
53 } // namespace webrtc 52 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/libjingle/xmpp/xmpplogintask_unittest.cc ('k') | webrtc/modules/congestion_controller/include/congestion_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698