Remove more CriticalSectionWrappers.
BUG=webrtc:7035 Review-Url: https://codereview.webrtc.org/2785673002 Cr-Commit-Position: refs/heads/master@{#17465}
This commit is contained in:
@ -62,7 +62,6 @@ static const unsigned int ALSA_CAPTURE_WAIT_TIMEOUT = 5; // in ms
|
||||
|
||||
AudioDeviceLinuxALSA::AudioDeviceLinuxALSA(const int32_t id) :
|
||||
_ptrAudioBuffer(NULL),
|
||||
_critSect(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_id(id),
|
||||
_mixerManager(id),
|
||||
_inputDeviceIndex(0),
|
||||
@ -130,13 +129,12 @@ AudioDeviceLinuxALSA::~AudioDeviceLinuxALSA()
|
||||
delete [] _playoutBuffer;
|
||||
_playoutBuffer = NULL;
|
||||
}
|
||||
delete &_critSect;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxALSA::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer)
|
||||
{
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
_ptrAudioBuffer = audioBuffer;
|
||||
|
||||
@ -157,7 +155,7 @@ int32_t AudioDeviceLinuxALSA::ActiveAudioLayer(
|
||||
}
|
||||
|
||||
AudioDeviceGeneric::InitStatus AudioDeviceLinuxALSA::Init() {
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
// Load libasound
|
||||
if (!AlsaSymbolTable.Load()) {
|
||||
@ -194,7 +192,7 @@ int32_t AudioDeviceLinuxALSA::Terminate()
|
||||
return 0;
|
||||
}
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
_mixerManager.Close();
|
||||
|
||||
@ -243,7 +241,7 @@ bool AudioDeviceLinuxALSA::Initialized() const
|
||||
int32_t AudioDeviceLinuxALSA::InitSpeaker()
|
||||
{
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_playing)
|
||||
{
|
||||
@ -258,7 +256,7 @@ int32_t AudioDeviceLinuxALSA::InitSpeaker()
|
||||
int32_t AudioDeviceLinuxALSA::InitMicrophone()
|
||||
{
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_recording)
|
||||
{
|
||||
@ -560,7 +558,7 @@ int32_t AudioDeviceLinuxALSA::MicrophoneBoost(bool& enabled) const
|
||||
int32_t AudioDeviceLinuxALSA::StereoRecordingIsAvailable(bool& available)
|
||||
{
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
// If we already have initialized in stereo it's obviously available
|
||||
if (_recIsInitialized && (2 == _recChannels))
|
||||
@ -631,7 +629,7 @@ int32_t AudioDeviceLinuxALSA::StereoRecording(bool& enabled) const
|
||||
int32_t AudioDeviceLinuxALSA::StereoPlayoutIsAvailable(bool& available)
|
||||
{
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
// If we already have initialized in stereo it's obviously available
|
||||
if (_playIsInitialized && (2 == _playChannels))
|
||||
@ -1009,7 +1007,7 @@ int32_t AudioDeviceLinuxALSA::InitPlayout()
|
||||
|
||||
int errVal = 0;
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
if (_playing)
|
||||
{
|
||||
return -1;
|
||||
@ -1162,7 +1160,7 @@ int32_t AudioDeviceLinuxALSA::InitRecording()
|
||||
|
||||
int errVal = 0;
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_recording)
|
||||
{
|
||||
@ -1397,7 +1395,7 @@ int32_t AudioDeviceLinuxALSA::StopRecording()
|
||||
{
|
||||
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (!_recIsInitialized)
|
||||
{
|
||||
@ -1420,7 +1418,7 @@ int32_t AudioDeviceLinuxALSA::StopRecording()
|
||||
_ptrThreadRec.reset();
|
||||
}
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_recordingFramesLeft = 0;
|
||||
if (_recordingBuffer)
|
||||
{
|
||||
@ -1523,7 +1521,7 @@ int32_t AudioDeviceLinuxALSA::StopPlayout()
|
||||
{
|
||||
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (!_playIsInitialized)
|
||||
{
|
||||
@ -1545,7 +1543,7 @@ int32_t AudioDeviceLinuxALSA::StopPlayout()
|
||||
_ptrThreadPlay.reset();
|
||||
}
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
_playoutFramesLeft = 0;
|
||||
delete [] _playoutBuffer;
|
||||
@ -1635,49 +1633,49 @@ int32_t AudioDeviceLinuxALSA::CPULoad(uint16_t& load) const
|
||||
|
||||
bool AudioDeviceLinuxALSA::PlayoutWarning() const
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_playWarning > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxALSA::PlayoutError() const
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_playError > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxALSA::RecordingWarning() const
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_recWarning > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxALSA::RecordingError() const
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_recError > 0);
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxALSA::ClearPlayoutWarning()
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_playWarning = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxALSA::ClearPlayoutError()
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_playError = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxALSA::ClearRecordingWarning()
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_recWarning = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxALSA::ClearRecordingError()
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_recError = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -13,10 +13,10 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#include "webrtc/base/platform_thread.h"
|
||||
#include "webrtc/modules/audio_device/audio_device_generic.h"
|
||||
#include "webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.h"
|
||||
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include <X11/Xlib.h>
|
||||
@ -145,7 +145,6 @@ public:
|
||||
// CPU load
|
||||
int32_t CPULoad(uint16_t& load) const override;
|
||||
|
||||
public:
|
||||
bool PlayoutWarning() const override;
|
||||
bool PlayoutError() const override;
|
||||
bool RecordingWarning() const override;
|
||||
@ -155,7 +154,6 @@ public:
|
||||
void ClearRecordingWarning() override;
|
||||
void ClearRecordingError() override;
|
||||
|
||||
public:
|
||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||
|
||||
private:
|
||||
@ -166,26 +164,22 @@ private:
|
||||
const int32_t ednLen = 0) const;
|
||||
int32_t ErrorRecovery(int32_t error, snd_pcm_t* deviceHandle);
|
||||
|
||||
private:
|
||||
bool KeyPressed() const;
|
||||
|
||||
private:
|
||||
void Lock() EXCLUSIVE_LOCK_FUNCTION(_critSect) { _critSect.Enter(); };
|
||||
void UnLock() UNLOCK_FUNCTION(_critSect) { _critSect.Leave(); };
|
||||
private:
|
||||
|
||||
inline int32_t InputSanityCheckAfterUnlockedPeriod() const;
|
||||
inline int32_t OutputSanityCheckAfterUnlockedPeriod() const;
|
||||
|
||||
private:
|
||||
static bool RecThreadFunc(void*);
|
||||
static bool PlayThreadFunc(void*);
|
||||
bool RecThreadProcess();
|
||||
bool PlayThreadProcess();
|
||||
|
||||
private:
|
||||
AudioDeviceBuffer* _ptrAudioBuffer;
|
||||
|
||||
CriticalSectionWrapper& _critSect;
|
||||
rtc::CriticalSection _critSect;
|
||||
|
||||
// TODO(pbos): Make plain members and start/stop instead of resetting these
|
||||
// pointers. A thread can be reused.
|
||||
@ -226,7 +220,6 @@ private:
|
||||
|
||||
AudioDeviceModule::BufferType _playBufType;
|
||||
|
||||
private:
|
||||
bool _initialized;
|
||||
bool _recording;
|
||||
bool _playing;
|
||||
|
||||
@ -30,7 +30,6 @@ namespace webrtc
|
||||
|
||||
AudioDeviceLinuxPulse::AudioDeviceLinuxPulse(const int32_t id) :
|
||||
_ptrAudioBuffer(NULL),
|
||||
_critSect(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_timeEventRec(*EventWrapper::Create()),
|
||||
_timeEventPlay(*EventWrapper::Create()),
|
||||
_recStartEvent(*EventWrapper::Create()),
|
||||
@ -133,7 +132,6 @@ AudioDeviceLinuxPulse::~AudioDeviceLinuxPulse()
|
||||
delete &_playStartEvent;
|
||||
delete &_timeEventRec;
|
||||
delete &_timeEventPlay;
|
||||
delete &_critSect;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxPulse::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer)
|
||||
@ -751,7 +749,7 @@ int32_t AudioDeviceLinuxPulse::StereoPlayout(bool& enabled) const
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::SetAGC(bool enable)
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_AGC = enable;
|
||||
|
||||
return 0;
|
||||
@ -759,7 +757,7 @@ int32_t AudioDeviceLinuxPulse::SetAGC(bool enable)
|
||||
|
||||
bool AudioDeviceLinuxPulse::AGC() const
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return _AGC;
|
||||
}
|
||||
|
||||
@ -1346,7 +1344,7 @@ int32_t AudioDeviceLinuxPulse::StartRecording()
|
||||
if (kEventTimeout == _recStartEvent.Wait(10000))
|
||||
{
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_startRec = false;
|
||||
}
|
||||
StopRecording();
|
||||
@ -1356,7 +1354,7 @@ int32_t AudioDeviceLinuxPulse::StartRecording()
|
||||
}
|
||||
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
if (_recording)
|
||||
{
|
||||
// The recording state is set by the audio thread after recording
|
||||
@ -1375,7 +1373,7 @@ int32_t AudioDeviceLinuxPulse::StartRecording()
|
||||
int32_t AudioDeviceLinuxPulse::StopRecording()
|
||||
{
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (!_recIsInitialized)
|
||||
{
|
||||
@ -1469,7 +1467,7 @@ int32_t AudioDeviceLinuxPulse::StartPlayout()
|
||||
|
||||
// Set state to ensure that playout starts from the audio thread.
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_startPlay = true;
|
||||
}
|
||||
|
||||
@ -1481,7 +1479,7 @@ int32_t AudioDeviceLinuxPulse::StartPlayout()
|
||||
if (kEventTimeout == _playStartEvent.Wait(10000))
|
||||
{
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_startPlay = false;
|
||||
}
|
||||
StopPlayout();
|
||||
@ -1491,7 +1489,7 @@ int32_t AudioDeviceLinuxPulse::StartPlayout()
|
||||
}
|
||||
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
if (_playing)
|
||||
{
|
||||
// The playing state is set by the audio thread after playout
|
||||
@ -1510,7 +1508,7 @@ int32_t AudioDeviceLinuxPulse::StartPlayout()
|
||||
int32_t AudioDeviceLinuxPulse::StopPlayout()
|
||||
{
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (!_playIsInitialized)
|
||||
{
|
||||
@ -1574,7 +1572,7 @@ int32_t AudioDeviceLinuxPulse::StopPlayout()
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::PlayoutDelay(uint16_t& delayMS) const
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
delayMS = (uint16_t) _sndCardPlayDelay;
|
||||
return 0;
|
||||
}
|
||||
@ -1631,49 +1629,49 @@ int32_t AudioDeviceLinuxPulse::CPULoad(uint16_t& /*load*/) const
|
||||
|
||||
bool AudioDeviceLinuxPulse::PlayoutWarning() const
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_playWarning > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxPulse::PlayoutError() const
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_playError > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxPulse::RecordingWarning() const
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_recWarning > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxPulse::RecordingError() const
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_recError > 0);
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxPulse::ClearPlayoutWarning()
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_playWarning = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxPulse::ClearPlayoutError()
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_playError = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxPulse::ClearRecordingWarning()
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_recWarning = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxPulse::ClearRecordingError()
|
||||
{
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_recError = 0;
|
||||
}
|
||||
|
||||
@ -2602,7 +2600,7 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess()
|
||||
return true;
|
||||
}
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_startPlay)
|
||||
{
|
||||
@ -2843,7 +2841,7 @@ bool AudioDeviceLinuxPulse::RecThreadProcess()
|
||||
return true;
|
||||
}
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_startRec)
|
||||
{
|
||||
|
||||
@ -13,11 +13,11 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#include "webrtc/base/platform_thread.h"
|
||||
#include "webrtc/base/thread_checker.h"
|
||||
#include "webrtc/modules/audio_device/audio_device_generic.h"
|
||||
#include "webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.h"
|
||||
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <pulse/pulseaudio.h>
|
||||
@ -280,7 +280,7 @@ private:
|
||||
|
||||
AudioDeviceBuffer* _ptrAudioBuffer;
|
||||
|
||||
CriticalSectionWrapper& _critSect;
|
||||
rtc::CriticalSection _critSect;
|
||||
EventWrapper& _timeEventRec;
|
||||
EventWrapper& _timeEventPlay;
|
||||
EventWrapper& _recStartEvent;
|
||||
|
||||
@ -25,7 +25,6 @@ namespace webrtc
|
||||
{
|
||||
|
||||
AudioMixerManagerLinuxALSA::AudioMixerManagerLinuxALSA(const int32_t id) :
|
||||
_critSect(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_id(id),
|
||||
_outputMixerHandle(NULL),
|
||||
_inputMixerHandle(NULL),
|
||||
@ -43,10 +42,7 @@ AudioMixerManagerLinuxALSA::~AudioMixerManagerLinuxALSA()
|
||||
{
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id,
|
||||
"%s destructed", __FUNCTION__);
|
||||
|
||||
Close();
|
||||
|
||||
delete &_critSect;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@ -58,7 +54,7 @@ int32_t AudioMixerManagerLinuxALSA::Close()
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
CloseSpeaker();
|
||||
CloseMicrophone();
|
||||
@ -72,7 +68,7 @@ int32_t AudioMixerManagerLinuxALSA::CloseSpeaker()
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
int errVal = 0;
|
||||
|
||||
@ -113,7 +109,7 @@ int32_t AudioMixerManagerLinuxALSA::CloseMicrophone()
|
||||
{
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", __FUNCTION__);
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
int errVal = 0;
|
||||
|
||||
@ -165,7 +161,7 @@ int32_t AudioMixerManagerLinuxALSA::OpenSpeaker(char* deviceName)
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id,
|
||||
"AudioMixerManagerLinuxALSA::OpenSpeaker(name=%s)", deviceName);
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
int errVal = 0;
|
||||
|
||||
@ -259,7 +255,7 @@ int32_t AudioMixerManagerLinuxALSA::OpenMicrophone(char *deviceName)
|
||||
"AudioMixerManagerLinuxALSA::OpenMicrophone(name=%s)",
|
||||
deviceName);
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
int errVal = 0;
|
||||
|
||||
@ -378,7 +374,7 @@ int32_t AudioMixerManagerLinuxALSA::SetSpeakerVolume(
|
||||
"AudioMixerManagerLinuxALSA::SetSpeakerVolume(volume=%u)",
|
||||
volume);
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_outputMixerElement == NULL)
|
||||
{
|
||||
@ -642,7 +638,7 @@ int32_t AudioMixerManagerLinuxALSA::SetSpeakerMute(bool enable)
|
||||
"AudioMixerManagerLinuxALSA::SetSpeakerMute(enable=%u)",
|
||||
enable);
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_outputMixerElement == NULL)
|
||||
{
|
||||
@ -739,7 +735,7 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneMute(bool enable)
|
||||
"AudioMixerManagerLinuxALSA::SetMicrophoneMute(enable=%u)",
|
||||
enable);
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_inputMixerElement == NULL)
|
||||
{
|
||||
@ -838,7 +834,7 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneBoost(bool enable)
|
||||
"AudioMixerManagerLinuxALSA::SetMicrophoneBoost(enable=%u)",
|
||||
enable);
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_inputMixerHandle == NULL)
|
||||
{
|
||||
@ -900,7 +896,7 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneVolume(
|
||||
"AudioMixerManagerLinuxALSA::SetMicrophoneVolume(volume=%u)",
|
||||
volume);
|
||||
|
||||
CriticalSectionScoped lock(&_critSect);
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_inputMixerElement == NULL)
|
||||
{
|
||||
@ -1296,19 +1292,16 @@ void AudioMixerManagerLinuxALSA::GetControlName(char* controlName,
|
||||
// controlName: "hw:CARD=Intel"
|
||||
char* pos1 = strchr(deviceName, ':');
|
||||
char* pos2 = strchr(deviceName, ',');
|
||||
if (!pos2)
|
||||
{
|
||||
if (!pos2) {
|
||||
// Can also be default:CARD=Intel
|
||||
pos2 = &deviceName[strlen(deviceName)];
|
||||
}
|
||||
if (pos1 && pos2)
|
||||
{
|
||||
if (pos1 && pos2) {
|
||||
strcpy(controlName, "hw");
|
||||
int nChar = (int) (pos2 - pos1);
|
||||
strncpy(&controlName[2], pos1, nChar);
|
||||
controlName[2 + nChar] = '\0';
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
strcpy(controlName, deviceName);
|
||||
}
|
||||
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
#ifndef WEBRTC_AUDIO_DEVICE_AUDIO_MIXER_MANAGER_ALSA_LINUX_H
|
||||
#define WEBRTC_AUDIO_DEVICE_AUDIO_MIXER_MANAGER_ALSA_LINUX_H
|
||||
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#include "webrtc/modules/audio_device/include/audio_device.h"
|
||||
#include "webrtc/modules/audio_device/linux/alsasymboltable_linux.h"
|
||||
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
@ -63,7 +63,7 @@ private:
|
||||
void GetControlName(char *controlName, char* deviceName) const;
|
||||
|
||||
private:
|
||||
CriticalSectionWrapper& _critSect;
|
||||
rtc::CriticalSection _critSect;
|
||||
int32_t _id;
|
||||
mutable snd_mixer_t* _outputMixerHandle;
|
||||
char _outputMixerStr[kAdmMaxDeviceNameSize];
|
||||
|
||||
Reference in New Issue
Block a user