2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #include "webrtc/modules/audio_device/dummy/file_audio_device_factory.h"
15 #include "webrtc/modules/audio_device/dummy/file_audio_device.h"
19 char FileAudioDeviceFactory::_inputAudioFilename[MAX_FILENAME_LEN] = "";
20 char FileAudioDeviceFactory::_outputAudioFilename[MAX_FILENAME_LEN] = "";
22 FileAudioDevice* FileAudioDeviceFactory::CreateFileAudioDevice(
24 // Bail out here if the files aren't set.
25 if (strlen(_inputAudioFilename) == 0 || strlen(_outputAudioFilename) == 0) {
26 printf("Was compiled with WEBRTC_DUMMY_AUDIO_PLAY_STATIC_FILE "
27 "but did not set input/output files to use. Bailing out.\n");
30 return new FileAudioDevice(id, _inputAudioFilename, _outputAudioFilename);
33 void FileAudioDeviceFactory::SetFilenamesToUse(
34 const char* inputAudioFilename, const char* outputAudioFilename) {
35 #ifdef WEBRTC_DUMMY_FILE_DEVICES
36 assert(strlen(inputAudioFilename) < MAX_FILENAME_LEN &&
37 strlen(outputAudioFilename) < MAX_FILENAME_LEN);
39 // Copy the strings since we don't know the lifetime of the input pointers.
40 strncpy(_inputAudioFilename, inputAudioFilename, MAX_FILENAME_LEN);
41 strncpy(_outputAudioFilename, outputAudioFilename, MAX_FILENAME_LEN);
43 // Sanity: must be compiled with the right define to run this.
44 printf("Trying to use dummy file devices, but is not compiled "
45 "with WEBRTC_DUMMY_FILE_DEVICES. Bailing out.\n");