Create an empty device utility dummy, in order to stop using _linux suffixed files on non-Linux OSes.

Besides being a good idea in general, this lets us use the good chromium_code==1 warning settings on Mac and Windows. (chromium_code automatically excludes _linux suffixed files on non-Linux.)
Review URL: http://webrtc-codereview.appspot.com/93010

git-svn-id: http://webrtc.googlecode.com/svn/trunk@272 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
ajm@google.com 2011-07-29 18:03:57 +00:00
parent f8dc8dc5f6
commit e89f6b5574
4 changed files with 101 additions and 9 deletions

View File

@ -0,0 +1,57 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "audio_device_utility_dummy.h"
#include "audio_device_config.h" // DEBUG_PRINT()
#include "critical_section_wrapper.h"
#include "trace.h"
namespace webrtc
{
AudioDeviceUtilityDummy::AudioDeviceUtilityDummy(const WebRtc_Word32 id) :
_critSect(*CriticalSectionWrapper::CreateCriticalSection()), _id(id),
_lastError(AudioDeviceModule::kAdmErrNone)
{
WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, id,
"%s created", __FUNCTION__);
}
AudioDeviceUtilityDummy::~AudioDeviceUtilityDummy()
{
WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id,
"%s destroyed", __FUNCTION__);
{
CriticalSectionScoped lock(_critSect);
// free stuff here...
}
delete &_critSect;
}
// ============================================================================
// API
// ============================================================================
WebRtc_Word32 AudioDeviceUtilityDummy::Init()
{
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioDevice, _id,
"%s", __FUNCTION__);
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id,
" OS info: %s", "Dummy");
return 0;
}
} // namespace webrtc

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_UTILITY_DUMMY_H
#define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_UTILITY_DUMMY_H
#include "audio_device_utility.h"
#include "audio_device.h"
namespace webrtc
{
class CriticalSectionWrapper;
class AudioDeviceUtilityDummy: public AudioDeviceUtility
{
public:
AudioDeviceUtilityDummy(const WebRtc_Word32 id);
~AudioDeviceUtilityDummy();
virtual WebRtc_Word32 Init();
private:
CriticalSectionWrapper& _critSect;
WebRtc_Word32 _id;
AudioDeviceModule::ErrorCode _lastError;
};
} // namespace webrtc
#endif // MODULES_AUDIO_DEVICE_MAIN_SOURCE_LINUX_AUDIO_DEVICE_UTILITY_DUMMY_H_

View File

@ -24,7 +24,6 @@
'../../../interface',
'../interface',
'Dummy', # Dummy audio device
'Linux', # Dummy audio device uses linux utility (empty)
],
'direct_dependent_settings': {
'include_dirs': [
@ -48,6 +47,8 @@
'audio_device_config.h',
'Dummy/audio_device_dummy.cc',
'Dummy/audio_device_dummy.h',
'Dummy/audio_device_utility_dummy.cc',
'Dummy/audio_device_utility_dummy.h',
'Linux/alsasymboltable.cc',
'Linux/alsasymboltable.h',
'Linux/audio_device_linux_alsa.cc',
@ -87,9 +88,8 @@
'Linux/audio_mixer_manager_linux_alsa.h',
'Linux/latebindingsymboltable.cc',
'Linux/latebindingsymboltable.h',
# Don't remove these, needed for dummy device
# 'Linux/audio_device_utility_linux.cc',
# 'Linux/audio_device_utility_linux.h',
'Linux/audio_device_utility_linux.cc',
'Linux/audio_device_utility_linux.h',
],
}],
['OS!="mac"', {
@ -168,7 +168,7 @@
'../../../../../..',
],
}],
] # conditions
] # conditions
},
{
'target_name': 'audio_device_test_api',

View File

@ -44,8 +44,7 @@
#include "audio_device_mac.h"
#endif
#include "audio_device_dummy.h"
// audio_device_utility_linux.h is used for both linux device and dummy device
#include "audio_device_utility_linux.h"
#include "audio_device_utility_dummy.h"
#include <cassert>
@ -416,8 +415,7 @@ WebRtc_Word32 AudioDeviceModuleImpl::CreatePlatformSpecificObjects()
if (ptrAudioDevice != NULL)
{
// Create the Linux implementation of the Device Utility. (It's empty.)
ptrAudioDeviceUtility = new AudioDeviceUtilityLinux(Id());
ptrAudioDeviceUtility = new AudioDeviceUtilityDummy(Id());
}
}