Remove the useless dummy audio device impl which creates threads and high res timers on windows.

BUG=630
Test=apprtc.appspot.com in chrome
Review URL: https://webrtc-codereview.appspot.com/667010

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2494 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
xians@webrtc.org
2012-07-06 08:33:13 +00:00
parent 2eefb2242f
commit e9eb235bc1
5 changed files with 118 additions and 1545 deletions

View File

@@ -42,9 +42,7 @@
'audio_device_impl.cc', 'audio_device_impl.cc',
'audio_device_impl.h', 'audio_device_impl.h',
'audio_device_config.h', 'audio_device_config.h',
'dummy/audio_device_dummy.cc',
'dummy/audio_device_dummy.h', 'dummy/audio_device_dummy.h',
'dummy/audio_device_utility_dummy.cc',
'dummy/audio_device_utility_dummy.h', 'dummy/audio_device_utility_dummy.h',
], ],
'conditions': [ 'conditions': [

View File

@@ -14,176 +14,175 @@
#include <stdio.h> #include <stdio.h>
#include "audio_device_generic.h" #include "audio_device_generic.h"
#include "critical_section_wrapper.h"
namespace webrtc { namespace webrtc {
class EventWrapper;
class ThreadWrapper;
class AudioDeviceDummy : public AudioDeviceGeneric class AudioDeviceDummy : public AudioDeviceGeneric
{ {
public: public:
AudioDeviceDummy(const WebRtc_Word32 id); AudioDeviceDummy(const WebRtc_Word32 id) {}
~AudioDeviceDummy(); ~AudioDeviceDummy() {}
// Retrieve the currently utilized audio layer // Retrieve the currently utilized audio layer
virtual WebRtc_Word32 ActiveAudioLayer(AudioDeviceModule::AudioLayer& audioLayer) const; virtual WebRtc_Word32 ActiveAudioLayer(
AudioDeviceModule::AudioLayer& audioLayer) const { return -1; }
// Main initializaton and termination // Main initializaton and termination
virtual WebRtc_Word32 Init(); virtual WebRtc_Word32 Init() { return 0; }
virtual WebRtc_Word32 Terminate(); virtual WebRtc_Word32 Terminate() { return 0; }
virtual bool Initialized() const; virtual bool Initialized() const { return true; }
// Device enumeration // Device enumeration
virtual WebRtc_Word16 PlayoutDevices(); virtual WebRtc_Word16 PlayoutDevices() { return -1; }
virtual WebRtc_Word16 RecordingDevices(); virtual WebRtc_Word16 RecordingDevices() { return -1; }
virtual WebRtc_Word32 PlayoutDeviceName( virtual WebRtc_Word32 PlayoutDeviceName(
WebRtc_UWord16 index, WebRtc_UWord16 index,
char name[kAdmMaxDeviceNameSize], char name[kAdmMaxDeviceNameSize],
char guid[kAdmMaxGuidSize]); char guid[kAdmMaxGuidSize]) { return -1; }
virtual WebRtc_Word32 RecordingDeviceName( virtual WebRtc_Word32 RecordingDeviceName(
WebRtc_UWord16 index, WebRtc_UWord16 index,
char name[kAdmMaxDeviceNameSize], char name[kAdmMaxDeviceNameSize],
char guid[kAdmMaxGuidSize]); char guid[kAdmMaxGuidSize]) { return -1; }
// Device selection // Device selection
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index); virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index) { return -1; }
virtual WebRtc_Word32 SetPlayoutDevice( virtual WebRtc_Word32 SetPlayoutDevice(
AudioDeviceModule::WindowsDeviceType device); AudioDeviceModule::WindowsDeviceType device) { return -1; }
virtual WebRtc_Word32 SetRecordingDevice(WebRtc_UWord16 index); virtual WebRtc_Word32 SetRecordingDevice(WebRtc_UWord16 index) {
return -1;
}
virtual WebRtc_Word32 SetRecordingDevice( virtual WebRtc_Word32 SetRecordingDevice(
AudioDeviceModule::WindowsDeviceType device); AudioDeviceModule::WindowsDeviceType device) { return -1; }
// Audio transport initialization // Audio transport initialization
virtual WebRtc_Word32 PlayoutIsAvailable(bool& available); virtual WebRtc_Word32 PlayoutIsAvailable(bool& available) {
virtual WebRtc_Word32 InitPlayout(); return -1; }
virtual bool PlayoutIsInitialized() const; virtual WebRtc_Word32 InitPlayout() { return -1; };
virtual WebRtc_Word32 RecordingIsAvailable(bool& available); virtual bool PlayoutIsInitialized() const { return false; }
virtual WebRtc_Word32 InitRecording(); virtual WebRtc_Word32 RecordingIsAvailable(bool& available) { return -1; }
virtual bool RecordingIsInitialized() const; virtual WebRtc_Word32 InitRecording() { return -1; }
virtual bool RecordingIsInitialized() const { return false; }
// Audio transport control // Audio transport control
virtual WebRtc_Word32 StartPlayout(); virtual WebRtc_Word32 StartPlayout() { return -1; }
virtual WebRtc_Word32 StopPlayout(); virtual WebRtc_Word32 StopPlayout() { return -1; }
virtual bool Playing() const; virtual bool Playing() const { return false; }
virtual WebRtc_Word32 StartRecording(); virtual WebRtc_Word32 StartRecording() { return -1; }
virtual WebRtc_Word32 StopRecording(); virtual WebRtc_Word32 StopRecording() { return -1; }
virtual bool Recording() const; virtual bool Recording() const { return false; }
// Microphone Automatic Gain Control (AGC) // Microphone Automatic Gain Control (AGC)
virtual WebRtc_Word32 SetAGC(bool enable); virtual WebRtc_Word32 SetAGC(bool enable) { return -1; }
virtual bool AGC() const; virtual bool AGC() const { return false; }
// Volume control based on the Windows Wave API (Windows only) // Volume control based on the Windows Wave API (Windows only)
virtual WebRtc_Word32 SetWaveOutVolume( virtual WebRtc_Word32 SetWaveOutVolume(
WebRtc_UWord16 volumeLeft, WebRtc_UWord16 volumeRight); WebRtc_UWord16 volumeLeft, WebRtc_UWord16 volumeRight) { return -1; }
virtual WebRtc_Word32 WaveOutVolume( virtual WebRtc_Word32 WaveOutVolume(
WebRtc_UWord16& volumeLeft, WebRtc_UWord16& volumeRight) const; WebRtc_UWord16& volumeLeft,
WebRtc_UWord16& volumeRight) const { return -1; }
// Audio mixer initialization // Audio mixer initialization
virtual WebRtc_Word32 SpeakerIsAvailable(bool& available); virtual WebRtc_Word32 SpeakerIsAvailable(bool& available) { return -1; }
virtual WebRtc_Word32 InitSpeaker(); virtual WebRtc_Word32 InitSpeaker() { return -1; }
virtual bool SpeakerIsInitialized() const; virtual bool SpeakerIsInitialized() const { return false; }
virtual WebRtc_Word32 MicrophoneIsAvailable(bool& available); virtual WebRtc_Word32 MicrophoneIsAvailable(bool& available) { return -1; }
virtual WebRtc_Word32 InitMicrophone(); virtual WebRtc_Word32 InitMicrophone() { return -1; }
virtual bool MicrophoneIsInitialized() const; virtual bool MicrophoneIsInitialized() const { return false; }
// Speaker volume controls // Speaker volume controls
virtual WebRtc_Word32 SpeakerVolumeIsAvailable(bool& available); virtual WebRtc_Word32 SpeakerVolumeIsAvailable(bool& available) {
virtual WebRtc_Word32 SetSpeakerVolume(WebRtc_UWord32 volume); return -1;
virtual WebRtc_Word32 SpeakerVolume(WebRtc_UWord32& volume) const; }
virtual WebRtc_Word32 MaxSpeakerVolume(WebRtc_UWord32& maxVolume) const; virtual WebRtc_Word32 SetSpeakerVolume(WebRtc_UWord32 volume) { return -1; }
virtual WebRtc_Word32 MinSpeakerVolume(WebRtc_UWord32& minVolume) const; virtual WebRtc_Word32 SpeakerVolume(WebRtc_UWord32& volume) const {
virtual WebRtc_Word32 SpeakerVolumeStepSize(WebRtc_UWord16& stepSize) const; return -1;
}
virtual WebRtc_Word32 MaxSpeakerVolume(WebRtc_UWord32& maxVolume) const {
return -1;
}
virtual WebRtc_Word32 MinSpeakerVolume(WebRtc_UWord32& minVolume) const {
return -1;
}
virtual WebRtc_Word32 SpeakerVolumeStepSize(
WebRtc_UWord16& stepSize) const { return -1; }
// Microphone volume controls // Microphone volume controls
virtual WebRtc_Word32 MicrophoneVolumeIsAvailable(bool& available); virtual WebRtc_Word32 MicrophoneVolumeIsAvailable(bool& available) {
virtual WebRtc_Word32 SetMicrophoneVolume(WebRtc_UWord32 volume); return -1;
virtual WebRtc_Word32 MicrophoneVolume(WebRtc_UWord32& volume) const; }
virtual WebRtc_Word32 MaxMicrophoneVolume(WebRtc_UWord32& maxVolume) const; virtual WebRtc_Word32 SetMicrophoneVolume(WebRtc_UWord32 volume) {
virtual WebRtc_Word32 MinMicrophoneVolume(WebRtc_UWord32& minVolume) const; return -1;
}
virtual WebRtc_Word32 MicrophoneVolume(WebRtc_UWord32& volume) const {
return -1;
}
virtual WebRtc_Word32 MaxMicrophoneVolume(WebRtc_UWord32& maxVolume) const {
return -1;
}
virtual WebRtc_Word32 MinMicrophoneVolume(
WebRtc_UWord32& minVolume) const { return -1; }
virtual WebRtc_Word32 MicrophoneVolumeStepSize( virtual WebRtc_Word32 MicrophoneVolumeStepSize(
WebRtc_UWord16& stepSize) const; WebRtc_UWord16& stepSize) const { return -1; }
// Speaker mute control // Speaker mute control
virtual WebRtc_Word32 SpeakerMuteIsAvailable(bool& available); virtual WebRtc_Word32 SpeakerMuteIsAvailable(bool& available) { return -1; }
virtual WebRtc_Word32 SetSpeakerMute(bool enable); virtual WebRtc_Word32 SetSpeakerMute(bool enable) { return -1; }
virtual WebRtc_Word32 SpeakerMute(bool& enabled) const; virtual WebRtc_Word32 SpeakerMute(bool& enabled) const { return -1; }
// Microphone mute control // Microphone mute control
virtual WebRtc_Word32 MicrophoneMuteIsAvailable(bool& available); virtual WebRtc_Word32 MicrophoneMuteIsAvailable(bool& available) {
virtual WebRtc_Word32 SetMicrophoneMute(bool enable); return -1;
virtual WebRtc_Word32 MicrophoneMute(bool& enabled) const; }
virtual WebRtc_Word32 SetMicrophoneMute(bool enable) { return -1; }
virtual WebRtc_Word32 MicrophoneMute(bool& enabled) const { return -1; }
// Microphone boost control // Microphone boost control
virtual WebRtc_Word32 MicrophoneBoostIsAvailable(bool& available); virtual WebRtc_Word32 MicrophoneBoostIsAvailable(bool& available) {
virtual WebRtc_Word32 SetMicrophoneBoost(bool enable); return -1;
virtual WebRtc_Word32 MicrophoneBoost(bool& enabled) const; }
virtual WebRtc_Word32 SetMicrophoneBoost(bool enable) { return -1; }
virtual WebRtc_Word32 MicrophoneBoost(bool& enabled) const { return -1; }
// Stereo support // Stereo support
virtual WebRtc_Word32 StereoPlayoutIsAvailable(bool& available); virtual WebRtc_Word32 StereoPlayoutIsAvailable(bool& available) {
virtual WebRtc_Word32 SetStereoPlayout(bool enable); return -1;
virtual WebRtc_Word32 StereoPlayout(bool& enabled) const; }
virtual WebRtc_Word32 StereoRecordingIsAvailable(bool& available); virtual WebRtc_Word32 SetStereoPlayout(bool enable) { return -1; }
virtual WebRtc_Word32 SetStereoRecording(bool enable); virtual WebRtc_Word32 StereoPlayout(bool& enabled) const { return -1; }
virtual WebRtc_Word32 StereoRecording(bool& enabled) const; virtual WebRtc_Word32 StereoRecordingIsAvailable(bool& available) {
return -1;
}
virtual WebRtc_Word32 SetStereoRecording(bool enable) { return -1; }
virtual WebRtc_Word32 StereoRecording(bool& enabled) const { return -1; }
// Delay information and control // Delay information and control
virtual WebRtc_Word32 SetPlayoutBuffer( virtual WebRtc_Word32 SetPlayoutBuffer(
const AudioDeviceModule::BufferType type, WebRtc_UWord16 sizeMS); const AudioDeviceModule::BufferType type,
WebRtc_UWord16 sizeMS) { return -1; }
virtual WebRtc_Word32 PlayoutBuffer( virtual WebRtc_Word32 PlayoutBuffer(
AudioDeviceModule::BufferType& type, WebRtc_UWord16& sizeMS) const; AudioDeviceModule::BufferType& type,
virtual WebRtc_Word32 PlayoutDelay(WebRtc_UWord16& delayMS) const; WebRtc_UWord16& sizeMS) const { return -1; }
virtual WebRtc_Word32 RecordingDelay(WebRtc_UWord16& delayMS) const; virtual WebRtc_Word32 PlayoutDelay(WebRtc_UWord16& delayMS) const {
return -1;
}
virtual WebRtc_Word32 RecordingDelay(WebRtc_UWord16& delayMS) const {
return -1;
}
// CPU load // CPU load
virtual WebRtc_Word32 CPULoad(WebRtc_UWord16& load) const; virtual WebRtc_Word32 CPULoad(WebRtc_UWord16& load) const { return -1; }
virtual bool PlayoutWarning() const; virtual bool PlayoutWarning() const { return false; }
virtual bool PlayoutError() const; virtual bool PlayoutError() const { return false; }
virtual bool RecordingWarning() const; virtual bool RecordingWarning() const { return false; }
virtual bool RecordingError() const; virtual bool RecordingError() const { return false; }
virtual void ClearPlayoutWarning(); virtual void ClearPlayoutWarning() {}
virtual void ClearPlayoutError(); virtual void ClearPlayoutError() {}
virtual void ClearRecordingWarning(); virtual void ClearRecordingWarning() {}
virtual void ClearRecordingError(); virtual void ClearRecordingError() {}
virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer); virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {}
private:
void Lock() { _critSect.Enter(); };
void UnLock() { _critSect.Leave(); };
static bool RecThreadFunc(void*);
static bool PlayThreadFunc(void*);
bool RecThreadProcess();
bool PlayThreadProcess();
AudioDeviceBuffer* _ptrAudioBuffer;
CriticalSectionWrapper& _critSect;
WebRtc_Word32 _id;
EventWrapper& _timeEventRec;
EventWrapper& _timeEventPlay;
EventWrapper& _recStartEvent;
EventWrapper& _playStartEvent;
ThreadWrapper* _ptrThreadRec;
ThreadWrapper* _ptrThreadPlay;
WebRtc_UWord32 _recThreadID;
WebRtc_UWord32 _playThreadID;
bool _initialized;
bool _recording;
bool _playing;
bool _recIsInitialized;
bool _playIsInitialized;
bool _speakerIsInitialized;
bool _microphoneIsInitialized;
WebRtc_Word8 _recBuffer[2*160];
FILE* _playDataFile;
}; };
} // namespace webrtc } // namespace webrtc

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2012 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)
{
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(kTraceStateInfo, kTraceAudioDevice, _id,
" OS info: %s", "Dummy");
return 0;
}
} // namespace webrtc

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * 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 * that can be found in the LICENSE file in the root of the source
@@ -21,14 +21,10 @@ class CriticalSectionWrapper;
class AudioDeviceUtilityDummy: public AudioDeviceUtility class AudioDeviceUtilityDummy: public AudioDeviceUtility
{ {
public: public:
AudioDeviceUtilityDummy(const WebRtc_Word32 id); AudioDeviceUtilityDummy(const WebRtc_Word32 id) {}
~AudioDeviceUtilityDummy(); ~AudioDeviceUtilityDummy() {}
virtual WebRtc_Word32 Init(); virtual WebRtc_Word32 Init() { return 0; }
private:
CriticalSectionWrapper& _critSect;
WebRtc_Word32 _id;
}; };
} // namespace webrtc } // namespace webrtc