Index: webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc |
diff --git a/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc b/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc |
index 29620eb043a36a0fad89351f961be047ad28ba9e..be5e17e14cb304e1df8ea04f69c76d96950848cf 100644 |
--- a/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc |
+++ b/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc |
@@ -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); |
} |