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:
parent
2eefb2242f
commit
e9eb235bc1
@ -42,9 +42,7 @@
|
||||
'audio_device_impl.cc',
|
||||
'audio_device_impl.h',
|
||||
'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',
|
||||
],
|
||||
'conditions': [
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,176 +14,175 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "audio_device_generic.h"
|
||||
#include "critical_section_wrapper.h"
|
||||
|
||||
namespace webrtc {
|
||||
class EventWrapper;
|
||||
class ThreadWrapper;
|
||||
|
||||
class AudioDeviceDummy : public AudioDeviceGeneric
|
||||
{
|
||||
public:
|
||||
AudioDeviceDummy(const WebRtc_Word32 id);
|
||||
~AudioDeviceDummy();
|
||||
AudioDeviceDummy(const WebRtc_Word32 id) {}
|
||||
~AudioDeviceDummy() {}
|
||||
|
||||
// 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
|
||||
virtual WebRtc_Word32 Init();
|
||||
virtual WebRtc_Word32 Terminate();
|
||||
virtual bool Initialized() const;
|
||||
virtual WebRtc_Word32 Init() { return 0; }
|
||||
virtual WebRtc_Word32 Terminate() { return 0; }
|
||||
virtual bool Initialized() const { return true; }
|
||||
|
||||
// Device enumeration
|
||||
virtual WebRtc_Word16 PlayoutDevices();
|
||||
virtual WebRtc_Word16 RecordingDevices();
|
||||
virtual WebRtc_Word16 PlayoutDevices() { return -1; }
|
||||
virtual WebRtc_Word16 RecordingDevices() { return -1; }
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
char guid[kAdmMaxGuidSize]) { return -1; }
|
||||
virtual WebRtc_Word32 RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
char guid[kAdmMaxGuidSize]) { return -1; }
|
||||
|
||||
// Device selection
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index);
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index) { return -1; }
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(
|
||||
AudioDeviceModule::WindowsDeviceType device);
|
||||
virtual WebRtc_Word32 SetRecordingDevice(WebRtc_UWord16 index);
|
||||
AudioDeviceModule::WindowsDeviceType device) { return -1; }
|
||||
virtual WebRtc_Word32 SetRecordingDevice(WebRtc_UWord16 index) {
|
||||
return -1;
|
||||
}
|
||||
virtual WebRtc_Word32 SetRecordingDevice(
|
||||
AudioDeviceModule::WindowsDeviceType device);
|
||||
AudioDeviceModule::WindowsDeviceType device) { return -1; }
|
||||
|
||||
// Audio transport initialization
|
||||
virtual WebRtc_Word32 PlayoutIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 InitPlayout();
|
||||
virtual bool PlayoutIsInitialized() const;
|
||||
virtual WebRtc_Word32 RecordingIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 InitRecording();
|
||||
virtual bool RecordingIsInitialized() const;
|
||||
virtual WebRtc_Word32 PlayoutIsAvailable(bool& available) {
|
||||
return -1; }
|
||||
virtual WebRtc_Word32 InitPlayout() { return -1; };
|
||||
virtual bool PlayoutIsInitialized() const { return false; }
|
||||
virtual WebRtc_Word32 RecordingIsAvailable(bool& available) { return -1; }
|
||||
virtual WebRtc_Word32 InitRecording() { return -1; }
|
||||
virtual bool RecordingIsInitialized() const { return false; }
|
||||
|
||||
// Audio transport control
|
||||
virtual WebRtc_Word32 StartPlayout();
|
||||
virtual WebRtc_Word32 StopPlayout();
|
||||
virtual bool Playing() const;
|
||||
virtual WebRtc_Word32 StartRecording();
|
||||
virtual WebRtc_Word32 StopRecording();
|
||||
virtual bool Recording() const;
|
||||
virtual WebRtc_Word32 StartPlayout() { return -1; }
|
||||
virtual WebRtc_Word32 StopPlayout() { return -1; }
|
||||
virtual bool Playing() const { return false; }
|
||||
virtual WebRtc_Word32 StartRecording() { return -1; }
|
||||
virtual WebRtc_Word32 StopRecording() { return -1; }
|
||||
virtual bool Recording() const { return false; }
|
||||
|
||||
// Microphone Automatic Gain Control (AGC)
|
||||
virtual WebRtc_Word32 SetAGC(bool enable);
|
||||
virtual bool AGC() const;
|
||||
virtual WebRtc_Word32 SetAGC(bool enable) { return -1; }
|
||||
virtual bool AGC() const { return false; }
|
||||
|
||||
// Volume control based on the Windows Wave API (Windows only)
|
||||
virtual WebRtc_Word32 SetWaveOutVolume(
|
||||
WebRtc_UWord16 volumeLeft, WebRtc_UWord16 volumeRight);
|
||||
WebRtc_UWord16 volumeLeft, WebRtc_UWord16 volumeRight) { return -1; }
|
||||
virtual WebRtc_Word32 WaveOutVolume(
|
||||
WebRtc_UWord16& volumeLeft, WebRtc_UWord16& volumeRight) const;
|
||||
WebRtc_UWord16& volumeLeft,
|
||||
WebRtc_UWord16& volumeRight) const { return -1; }
|
||||
|
||||
// Audio mixer initialization
|
||||
virtual WebRtc_Word32 SpeakerIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 InitSpeaker();
|
||||
virtual bool SpeakerIsInitialized() const;
|
||||
virtual WebRtc_Word32 MicrophoneIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 InitMicrophone();
|
||||
virtual bool MicrophoneIsInitialized() const;
|
||||
virtual WebRtc_Word32 SpeakerIsAvailable(bool& available) { return -1; }
|
||||
virtual WebRtc_Word32 InitSpeaker() { return -1; }
|
||||
virtual bool SpeakerIsInitialized() const { return false; }
|
||||
virtual WebRtc_Word32 MicrophoneIsAvailable(bool& available) { return -1; }
|
||||
virtual WebRtc_Word32 InitMicrophone() { return -1; }
|
||||
virtual bool MicrophoneIsInitialized() const { return false; }
|
||||
|
||||
// Speaker volume controls
|
||||
virtual WebRtc_Word32 SpeakerVolumeIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetSpeakerVolume(WebRtc_UWord32 volume);
|
||||
virtual WebRtc_Word32 SpeakerVolume(WebRtc_UWord32& volume) const;
|
||||
virtual WebRtc_Word32 MaxSpeakerVolume(WebRtc_UWord32& maxVolume) const;
|
||||
virtual WebRtc_Word32 MinSpeakerVolume(WebRtc_UWord32& minVolume) const;
|
||||
virtual WebRtc_Word32 SpeakerVolumeStepSize(WebRtc_UWord16& stepSize) const;
|
||||
virtual WebRtc_Word32 SpeakerVolumeIsAvailable(bool& available) {
|
||||
return -1;
|
||||
}
|
||||
virtual WebRtc_Word32 SetSpeakerVolume(WebRtc_UWord32 volume) { return -1; }
|
||||
virtual WebRtc_Word32 SpeakerVolume(WebRtc_UWord32& volume) 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
|
||||
virtual WebRtc_Word32 MicrophoneVolumeIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetMicrophoneVolume(WebRtc_UWord32 volume);
|
||||
virtual WebRtc_Word32 MicrophoneVolume(WebRtc_UWord32& volume) const;
|
||||
virtual WebRtc_Word32 MaxMicrophoneVolume(WebRtc_UWord32& maxVolume) const;
|
||||
virtual WebRtc_Word32 MinMicrophoneVolume(WebRtc_UWord32& minVolume) const;
|
||||
virtual WebRtc_Word32 MicrophoneVolumeIsAvailable(bool& available) {
|
||||
return -1;
|
||||
}
|
||||
virtual WebRtc_Word32 SetMicrophoneVolume(WebRtc_UWord32 volume) {
|
||||
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(
|
||||
WebRtc_UWord16& stepSize) const;
|
||||
WebRtc_UWord16& stepSize) const { return -1; }
|
||||
|
||||
// Speaker mute control
|
||||
virtual WebRtc_Word32 SpeakerMuteIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetSpeakerMute(bool enable);
|
||||
virtual WebRtc_Word32 SpeakerMute(bool& enabled) const;
|
||||
virtual WebRtc_Word32 SpeakerMuteIsAvailable(bool& available) { return -1; }
|
||||
virtual WebRtc_Word32 SetSpeakerMute(bool enable) { return -1; }
|
||||
virtual WebRtc_Word32 SpeakerMute(bool& enabled) const { return -1; }
|
||||
|
||||
// Microphone mute control
|
||||
virtual WebRtc_Word32 MicrophoneMuteIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetMicrophoneMute(bool enable);
|
||||
virtual WebRtc_Word32 MicrophoneMute(bool& enabled) const;
|
||||
virtual WebRtc_Word32 MicrophoneMuteIsAvailable(bool& available) {
|
||||
return -1;
|
||||
}
|
||||
virtual WebRtc_Word32 SetMicrophoneMute(bool enable) { return -1; }
|
||||
virtual WebRtc_Word32 MicrophoneMute(bool& enabled) const { return -1; }
|
||||
|
||||
// Microphone boost control
|
||||
virtual WebRtc_Word32 MicrophoneBoostIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetMicrophoneBoost(bool enable);
|
||||
virtual WebRtc_Word32 MicrophoneBoost(bool& enabled) const;
|
||||
virtual WebRtc_Word32 MicrophoneBoostIsAvailable(bool& available) {
|
||||
return -1;
|
||||
}
|
||||
virtual WebRtc_Word32 SetMicrophoneBoost(bool enable) { return -1; }
|
||||
virtual WebRtc_Word32 MicrophoneBoost(bool& enabled) const { return -1; }
|
||||
|
||||
// Stereo support
|
||||
virtual WebRtc_Word32 StereoPlayoutIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetStereoPlayout(bool enable);
|
||||
virtual WebRtc_Word32 StereoPlayout(bool& enabled) const;
|
||||
virtual WebRtc_Word32 StereoRecordingIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetStereoRecording(bool enable);
|
||||
virtual WebRtc_Word32 StereoRecording(bool& enabled) const;
|
||||
virtual WebRtc_Word32 StereoPlayoutIsAvailable(bool& available) {
|
||||
return -1;
|
||||
}
|
||||
virtual WebRtc_Word32 SetStereoPlayout(bool enable) { return -1; }
|
||||
virtual WebRtc_Word32 StereoPlayout(bool& enabled) const { return -1; }
|
||||
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
|
||||
virtual WebRtc_Word32 SetPlayoutBuffer(
|
||||
const AudioDeviceModule::BufferType type, WebRtc_UWord16 sizeMS);
|
||||
const AudioDeviceModule::BufferType type,
|
||||
WebRtc_UWord16 sizeMS) { return -1; }
|
||||
virtual WebRtc_Word32 PlayoutBuffer(
|
||||
AudioDeviceModule::BufferType& type, WebRtc_UWord16& sizeMS) const;
|
||||
virtual WebRtc_Word32 PlayoutDelay(WebRtc_UWord16& delayMS) const;
|
||||
virtual WebRtc_Word32 RecordingDelay(WebRtc_UWord16& delayMS) const;
|
||||
AudioDeviceModule::BufferType& type,
|
||||
WebRtc_UWord16& sizeMS) const { return -1; }
|
||||
virtual WebRtc_Word32 PlayoutDelay(WebRtc_UWord16& delayMS) const {
|
||||
return -1;
|
||||
}
|
||||
virtual WebRtc_Word32 RecordingDelay(WebRtc_UWord16& delayMS) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 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 PlayoutError() const;
|
||||
virtual bool RecordingWarning() const;
|
||||
virtual bool RecordingError() const;
|
||||
virtual void ClearPlayoutWarning();
|
||||
virtual void ClearPlayoutError();
|
||||
virtual void ClearRecordingWarning();
|
||||
virtual void ClearRecordingError();
|
||||
virtual bool PlayoutWarning() const { return false; }
|
||||
virtual bool PlayoutError() const { return false; }
|
||||
virtual bool RecordingWarning() const { return false; }
|
||||
virtual bool RecordingError() const { return false; }
|
||||
virtual void ClearPlayoutWarning() {}
|
||||
virtual void ClearPlayoutError() {}
|
||||
virtual void ClearRecordingWarning() {}
|
||||
virtual void ClearRecordingError() {}
|
||||
|
||||
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;
|
||||
virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {}
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -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
|
@ -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
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -21,14 +21,10 @@ class CriticalSectionWrapper;
|
||||
class AudioDeviceUtilityDummy: public AudioDeviceUtility
|
||||
{
|
||||
public:
|
||||
AudioDeviceUtilityDummy(const WebRtc_Word32 id);
|
||||
~AudioDeviceUtilityDummy();
|
||||
AudioDeviceUtilityDummy(const WebRtc_Word32 id) {}
|
||||
~AudioDeviceUtilityDummy() {}
|
||||
|
||||
virtual WebRtc_Word32 Init();
|
||||
|
||||
private:
|
||||
CriticalSectionWrapper& _critSect;
|
||||
WebRtc_Word32 _id;
|
||||
virtual WebRtc_Word32 Init() { return 0; }
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
Loading…
x
Reference in New Issue
Block a user