| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 static const unsigned int ALSA_CAPTURE_CH = 2; | 55 static const unsigned int ALSA_CAPTURE_CH = 2; |
| 56 static const unsigned int ALSA_CAPTURE_LATENCY = 40*1000; // in us | 56 static const unsigned int ALSA_CAPTURE_LATENCY = 40*1000; // in us |
| 57 static const unsigned int ALSA_CAPTURE_WAIT_TIMEOUT = 5; // in ms | 57 static const unsigned int ALSA_CAPTURE_WAIT_TIMEOUT = 5; // in ms |
| 58 | 58 |
| 59 #define FUNC_GET_NUM_OF_DEVICE 0 | 59 #define FUNC_GET_NUM_OF_DEVICE 0 |
| 60 #define FUNC_GET_DEVICE_NAME 1 | 60 #define FUNC_GET_DEVICE_NAME 1 |
| 61 #define FUNC_GET_DEVICE_NAME_FOR_AN_ENUM 2 | 61 #define FUNC_GET_DEVICE_NAME_FOR_AN_ENUM 2 |
| 62 | 62 |
| 63 AudioDeviceLinuxALSA::AudioDeviceLinuxALSA(const int32_t id) : | 63 AudioDeviceLinuxALSA::AudioDeviceLinuxALSA(const int32_t id) : |
| 64 _ptrAudioBuffer(NULL), | 64 _ptrAudioBuffer(NULL), |
| 65 _critSect(*CriticalSectionWrapper::CreateCriticalSection()), | |
| 66 _id(id), | 65 _id(id), |
| 67 _mixerManager(id), | 66 _mixerManager(id), |
| 68 _inputDeviceIndex(0), | 67 _inputDeviceIndex(0), |
| 69 _outputDeviceIndex(0), | 68 _outputDeviceIndex(0), |
| 70 _inputDeviceIsSpecified(false), | 69 _inputDeviceIsSpecified(false), |
| 71 _outputDeviceIsSpecified(false), | 70 _outputDeviceIsSpecified(false), |
| 72 _handleRecord(NULL), | 71 _handleRecord(NULL), |
| 73 _handlePlayout(NULL), | 72 _handlePlayout(NULL), |
| 74 _recordingBuffersizeInFrame(0), | 73 _recordingBuffersizeInFrame(0), |
| 75 _recordingPeriodSizeInFrame(0), | 74 _recordingPeriodSizeInFrame(0), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 if (_recordingBuffer) | 122 if (_recordingBuffer) |
| 124 { | 123 { |
| 125 delete [] _recordingBuffer; | 124 delete [] _recordingBuffer; |
| 126 _recordingBuffer = NULL; | 125 _recordingBuffer = NULL; |
| 127 } | 126 } |
| 128 if (_playoutBuffer) | 127 if (_playoutBuffer) |
| 129 { | 128 { |
| 130 delete [] _playoutBuffer; | 129 delete [] _playoutBuffer; |
| 131 _playoutBuffer = NULL; | 130 _playoutBuffer = NULL; |
| 132 } | 131 } |
| 133 delete &_critSect; | |
| 134 } | 132 } |
| 135 | 133 |
| 136 void AudioDeviceLinuxALSA::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) | 134 void AudioDeviceLinuxALSA::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) |
| 137 { | 135 { |
| 138 | 136 |
| 139 CriticalSectionScoped lock(&_critSect); | 137 rtc::CritScope lock(&_critSect); |
| 140 | 138 |
| 141 _ptrAudioBuffer = audioBuffer; | 139 _ptrAudioBuffer = audioBuffer; |
| 142 | 140 |
| 143 // Inform the AudioBuffer about default settings for this implementation. | 141 // Inform the AudioBuffer about default settings for this implementation. |
| 144 // Set all values to zero here since the actual settings will be done by | 142 // Set all values to zero here since the actual settings will be done by |
| 145 // InitPlayout and InitRecording later. | 143 // InitPlayout and InitRecording later. |
| 146 _ptrAudioBuffer->SetRecordingSampleRate(0); | 144 _ptrAudioBuffer->SetRecordingSampleRate(0); |
| 147 _ptrAudioBuffer->SetPlayoutSampleRate(0); | 145 _ptrAudioBuffer->SetPlayoutSampleRate(0); |
| 148 _ptrAudioBuffer->SetRecordingChannels(0); | 146 _ptrAudioBuffer->SetRecordingChannels(0); |
| 149 _ptrAudioBuffer->SetPlayoutChannels(0); | 147 _ptrAudioBuffer->SetPlayoutChannels(0); |
| 150 } | 148 } |
| 151 | 149 |
| 152 int32_t AudioDeviceLinuxALSA::ActiveAudioLayer( | 150 int32_t AudioDeviceLinuxALSA::ActiveAudioLayer( |
| 153 AudioDeviceModule::AudioLayer& audioLayer) const | 151 AudioDeviceModule::AudioLayer& audioLayer) const |
| 154 { | 152 { |
| 155 audioLayer = AudioDeviceModule::kLinuxAlsaAudio; | 153 audioLayer = AudioDeviceModule::kLinuxAlsaAudio; |
| 156 return 0; | 154 return 0; |
| 157 } | 155 } |
| 158 | 156 |
| 159 AudioDeviceGeneric::InitStatus AudioDeviceLinuxALSA::Init() { | 157 AudioDeviceGeneric::InitStatus AudioDeviceLinuxALSA::Init() { |
| 160 CriticalSectionScoped lock(&_critSect); | 158 rtc::CritScope lock(&_critSect); |
| 161 | 159 |
| 162 // Load libasound | 160 // Load libasound |
| 163 if (!AlsaSymbolTable.Load()) { | 161 if (!AlsaSymbolTable.Load()) { |
| 164 // Alsa is not installed on this system | 162 // Alsa is not installed on this system |
| 165 LOG(LS_ERROR) << "failed to load symbol table"; | 163 LOG(LS_ERROR) << "failed to load symbol table"; |
| 166 return InitStatus::OTHER_ERROR; | 164 return InitStatus::OTHER_ERROR; |
| 167 } | 165 } |
| 168 | 166 |
| 169 if (_initialized) { | 167 if (_initialized) { |
| 170 return InitStatus::OK; | 168 return InitStatus::OK; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 187 return InitStatus::OK; | 185 return InitStatus::OK; |
| 188 } | 186 } |
| 189 | 187 |
| 190 int32_t AudioDeviceLinuxALSA::Terminate() | 188 int32_t AudioDeviceLinuxALSA::Terminate() |
| 191 { | 189 { |
| 192 if (!_initialized) | 190 if (!_initialized) |
| 193 { | 191 { |
| 194 return 0; | 192 return 0; |
| 195 } | 193 } |
| 196 | 194 |
| 197 CriticalSectionScoped lock(&_critSect); | 195 rtc::CritScope lock(&_critSect); |
| 198 | 196 |
| 199 _mixerManager.Close(); | 197 _mixerManager.Close(); |
| 200 | 198 |
| 201 // RECORDING | 199 // RECORDING |
| 202 if (_ptrThreadRec) | 200 if (_ptrThreadRec) |
| 203 { | 201 { |
| 204 rtc::PlatformThread* tmpThread = _ptrThreadRec.release(); | 202 rtc::PlatformThread* tmpThread = _ptrThreadRec.release(); |
| 205 _critSect.Leave(); | 203 _critSect.Leave(); |
| 206 | 204 |
| 207 tmpThread->Stop(); | 205 tmpThread->Stop(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 236 } | 234 } |
| 237 | 235 |
| 238 bool AudioDeviceLinuxALSA::Initialized() const | 236 bool AudioDeviceLinuxALSA::Initialized() const |
| 239 { | 237 { |
| 240 return (_initialized); | 238 return (_initialized); |
| 241 } | 239 } |
| 242 | 240 |
| 243 int32_t AudioDeviceLinuxALSA::InitSpeaker() | 241 int32_t AudioDeviceLinuxALSA::InitSpeaker() |
| 244 { | 242 { |
| 245 | 243 |
| 246 CriticalSectionScoped lock(&_critSect); | 244 rtc::CritScope lock(&_critSect); |
| 247 | 245 |
| 248 if (_playing) | 246 if (_playing) |
| 249 { | 247 { |
| 250 return -1; | 248 return -1; |
| 251 } | 249 } |
| 252 | 250 |
| 253 char devName[kAdmMaxDeviceNameSize] = {0}; | 251 char devName[kAdmMaxDeviceNameSize] = {0}; |
| 254 GetDevicesInfo(2, true, _outputDeviceIndex, devName, kAdmMaxDeviceNameSize); | 252 GetDevicesInfo(2, true, _outputDeviceIndex, devName, kAdmMaxDeviceNameSize); |
| 255 return _mixerManager.OpenSpeaker(devName); | 253 return _mixerManager.OpenSpeaker(devName); |
| 256 } | 254 } |
| 257 | 255 |
| 258 int32_t AudioDeviceLinuxALSA::InitMicrophone() | 256 int32_t AudioDeviceLinuxALSA::InitMicrophone() |
| 259 { | 257 { |
| 260 | 258 |
| 261 CriticalSectionScoped lock(&_critSect); | 259 rtc::CritScope lock(&_critSect); |
| 262 | 260 |
| 263 if (_recording) | 261 if (_recording) |
| 264 { | 262 { |
| 265 return -1; | 263 return -1; |
| 266 } | 264 } |
| 267 | 265 |
| 268 char devName[kAdmMaxDeviceNameSize] = {0}; | 266 char devName[kAdmMaxDeviceNameSize] = {0}; |
| 269 GetDevicesInfo(2, false, _inputDeviceIndex, devName, kAdmMaxDeviceNameSize); | 267 GetDevicesInfo(2, false, _inputDeviceIndex, devName, kAdmMaxDeviceNameSize); |
| 270 return _mixerManager.OpenMicrophone(devName); | 268 return _mixerManager.OpenMicrophone(devName); |
| 271 } | 269 } |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 } | 551 } |
| 554 | 552 |
| 555 enabled = onOff; | 553 enabled = onOff; |
| 556 | 554 |
| 557 return 0; | 555 return 0; |
| 558 } | 556 } |
| 559 | 557 |
| 560 int32_t AudioDeviceLinuxALSA::StereoRecordingIsAvailable(bool& available) | 558 int32_t AudioDeviceLinuxALSA::StereoRecordingIsAvailable(bool& available) |
| 561 { | 559 { |
| 562 | 560 |
| 563 CriticalSectionScoped lock(&_critSect); | 561 rtc::CritScope lock(&_critSect); |
| 564 | 562 |
| 565 // If we already have initialized in stereo it's obviously available | 563 // If we already have initialized in stereo it's obviously available |
| 566 if (_recIsInitialized && (2 == _recChannels)) | 564 if (_recIsInitialized && (2 == _recChannels)) |
| 567 { | 565 { |
| 568 available = true; | 566 available = true; |
| 569 return 0; | 567 return 0; |
| 570 } | 568 } |
| 571 | 569 |
| 572 // Save rec states and the number of rec channels | 570 // Save rec states and the number of rec channels |
| 573 bool recIsInitialized = _recIsInitialized; | 571 bool recIsInitialized = _recIsInitialized; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 enabled = true; | 622 enabled = true; |
| 625 else | 623 else |
| 626 enabled = false; | 624 enabled = false; |
| 627 | 625 |
| 628 return 0; | 626 return 0; |
| 629 } | 627 } |
| 630 | 628 |
| 631 int32_t AudioDeviceLinuxALSA::StereoPlayoutIsAvailable(bool& available) | 629 int32_t AudioDeviceLinuxALSA::StereoPlayoutIsAvailable(bool& available) |
| 632 { | 630 { |
| 633 | 631 |
| 634 CriticalSectionScoped lock(&_critSect); | 632 rtc::CritScope lock(&_critSect); |
| 635 | 633 |
| 636 // If we already have initialized in stereo it's obviously available | 634 // If we already have initialized in stereo it's obviously available |
| 637 if (_playIsInitialized && (2 == _playChannels)) | 635 if (_playIsInitialized && (2 == _playChannels)) |
| 638 { | 636 { |
| 639 available = true; | 637 available = true; |
| 640 return 0; | 638 return 0; |
| 641 } | 639 } |
| 642 | 640 |
| 643 // Save rec states and the number of rec channels | 641 // Save rec states and the number of rec channels |
| 644 bool playIsInitialized = _playIsInitialized; | 642 bool playIsInitialized = _playIsInitialized; |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 } | 1000 } |
| 1003 | 1001 |
| 1004 return res; | 1002 return res; |
| 1005 } | 1003 } |
| 1006 | 1004 |
| 1007 int32_t AudioDeviceLinuxALSA::InitPlayout() | 1005 int32_t AudioDeviceLinuxALSA::InitPlayout() |
| 1008 { | 1006 { |
| 1009 | 1007 |
| 1010 int errVal = 0; | 1008 int errVal = 0; |
| 1011 | 1009 |
| 1012 CriticalSectionScoped lock(&_critSect); | 1010 rtc::CritScope lock(&_critSect); |
| 1013 if (_playing) | 1011 if (_playing) |
| 1014 { | 1012 { |
| 1015 return -1; | 1013 return -1; |
| 1016 } | 1014 } |
| 1017 | 1015 |
| 1018 if (!_outputDeviceIsSpecified) | 1016 if (!_outputDeviceIsSpecified) |
| 1019 { | 1017 { |
| 1020 return -1; | 1018 return -1; |
| 1021 } | 1019 } |
| 1022 | 1020 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 } | 1153 } |
| 1156 | 1154 |
| 1157 return 0; | 1155 return 0; |
| 1158 } | 1156 } |
| 1159 | 1157 |
| 1160 int32_t AudioDeviceLinuxALSA::InitRecording() | 1158 int32_t AudioDeviceLinuxALSA::InitRecording() |
| 1161 { | 1159 { |
| 1162 | 1160 |
| 1163 int errVal = 0; | 1161 int errVal = 0; |
| 1164 | 1162 |
| 1165 CriticalSectionScoped lock(&_critSect); | 1163 rtc::CritScope lock(&_critSect); |
| 1166 | 1164 |
| 1167 if (_recording) | 1165 if (_recording) |
| 1168 { | 1166 { |
| 1169 return -1; | 1167 return -1; |
| 1170 } | 1168 } |
| 1171 | 1169 |
| 1172 if (!_inputDeviceIsSpecified) | 1170 if (!_inputDeviceIsSpecified) |
| 1173 { | 1171 { |
| 1174 return -1; | 1172 return -1; |
| 1175 } | 1173 } |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 } | 1388 } |
| 1391 } | 1389 } |
| 1392 | 1390 |
| 1393 return 0; | 1391 return 0; |
| 1394 } | 1392 } |
| 1395 | 1393 |
| 1396 int32_t AudioDeviceLinuxALSA::StopRecording() | 1394 int32_t AudioDeviceLinuxALSA::StopRecording() |
| 1397 { | 1395 { |
| 1398 | 1396 |
| 1399 { | 1397 { |
| 1400 CriticalSectionScoped lock(&_critSect); | 1398 rtc::CritScope lock(&_critSect); |
| 1401 | 1399 |
| 1402 if (!_recIsInitialized) | 1400 if (!_recIsInitialized) |
| 1403 { | 1401 { |
| 1404 return 0; | 1402 return 0; |
| 1405 } | 1403 } |
| 1406 | 1404 |
| 1407 if (_handleRecord == NULL) | 1405 if (_handleRecord == NULL) |
| 1408 { | 1406 { |
| 1409 return -1; | 1407 return -1; |
| 1410 } | 1408 } |
| 1411 | 1409 |
| 1412 // Make sure we don't start recording (it's asynchronous). | 1410 // Make sure we don't start recording (it's asynchronous). |
| 1413 _recIsInitialized = false; | 1411 _recIsInitialized = false; |
| 1414 _recording = false; | 1412 _recording = false; |
| 1415 } | 1413 } |
| 1416 | 1414 |
| 1417 if (_ptrThreadRec) | 1415 if (_ptrThreadRec) |
| 1418 { | 1416 { |
| 1419 _ptrThreadRec->Stop(); | 1417 _ptrThreadRec->Stop(); |
| 1420 _ptrThreadRec.reset(); | 1418 _ptrThreadRec.reset(); |
| 1421 } | 1419 } |
| 1422 | 1420 |
| 1423 CriticalSectionScoped lock(&_critSect); | 1421 rtc::CritScope lock(&_critSect); |
| 1424 _recordingFramesLeft = 0; | 1422 _recordingFramesLeft = 0; |
| 1425 if (_recordingBuffer) | 1423 if (_recordingBuffer) |
| 1426 { | 1424 { |
| 1427 delete [] _recordingBuffer; | 1425 delete [] _recordingBuffer; |
| 1428 _recordingBuffer = NULL; | 1426 _recordingBuffer = NULL; |
| 1429 } | 1427 } |
| 1430 | 1428 |
| 1431 // Stop and close pcm recording device. | 1429 // Stop and close pcm recording device. |
| 1432 int errVal = LATE(snd_pcm_drop)(_handleRecord); | 1430 int errVal = LATE(snd_pcm_drop)(_handleRecord); |
| 1433 if (errVal < 0) | 1431 if (errVal < 0) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 // if snd_pcm_open fails will return -1 | 1514 // if snd_pcm_open fails will return -1 |
| 1517 } | 1515 } |
| 1518 | 1516 |
| 1519 return 0; | 1517 return 0; |
| 1520 } | 1518 } |
| 1521 | 1519 |
| 1522 int32_t AudioDeviceLinuxALSA::StopPlayout() | 1520 int32_t AudioDeviceLinuxALSA::StopPlayout() |
| 1523 { | 1521 { |
| 1524 | 1522 |
| 1525 { | 1523 { |
| 1526 CriticalSectionScoped lock(&_critSect); | 1524 rtc::CritScope lock(&_critSect); |
| 1527 | 1525 |
| 1528 if (!_playIsInitialized) | 1526 if (!_playIsInitialized) |
| 1529 { | 1527 { |
| 1530 return 0; | 1528 return 0; |
| 1531 } | 1529 } |
| 1532 | 1530 |
| 1533 if (_handlePlayout == NULL) | 1531 if (_handlePlayout == NULL) |
| 1534 { | 1532 { |
| 1535 return -1; | 1533 return -1; |
| 1536 } | 1534 } |
| 1537 | 1535 |
| 1538 _playing = false; | 1536 _playing = false; |
| 1539 } | 1537 } |
| 1540 | 1538 |
| 1541 // stop playout thread first | 1539 // stop playout thread first |
| 1542 if (_ptrThreadPlay) | 1540 if (_ptrThreadPlay) |
| 1543 { | 1541 { |
| 1544 _ptrThreadPlay->Stop(); | 1542 _ptrThreadPlay->Stop(); |
| 1545 _ptrThreadPlay.reset(); | 1543 _ptrThreadPlay.reset(); |
| 1546 } | 1544 } |
| 1547 | 1545 |
| 1548 CriticalSectionScoped lock(&_critSect); | 1546 rtc::CritScope lock(&_critSect); |
| 1549 | 1547 |
| 1550 _playoutFramesLeft = 0; | 1548 _playoutFramesLeft = 0; |
| 1551 delete [] _playoutBuffer; | 1549 delete [] _playoutBuffer; |
| 1552 _playoutBuffer = NULL; | 1550 _playoutBuffer = NULL; |
| 1553 | 1551 |
| 1554 // stop and close pcm playout device | 1552 // stop and close pcm playout device |
| 1555 int errVal = LATE(snd_pcm_drop)(_handlePlayout); | 1553 int errVal = LATE(snd_pcm_drop)(_handlePlayout); |
| 1556 if (errVal < 0) | 1554 if (errVal < 0) |
| 1557 { | 1555 { |
| 1558 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1556 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 int32_t AudioDeviceLinuxALSA::CPULoad(uint16_t& load) const | 1626 int32_t AudioDeviceLinuxALSA::CPULoad(uint16_t& load) const |
| 1629 { | 1627 { |
| 1630 | 1628 |
| 1631 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 1629 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
| 1632 " API call not supported on this platform"); | 1630 " API call not supported on this platform"); |
| 1633 return -1; | 1631 return -1; |
| 1634 } | 1632 } |
| 1635 | 1633 |
| 1636 bool AudioDeviceLinuxALSA::PlayoutWarning() const | 1634 bool AudioDeviceLinuxALSA::PlayoutWarning() const |
| 1637 { | 1635 { |
| 1638 CriticalSectionScoped lock(&_critSect); | 1636 rtc::CritScope lock(&_critSect); |
| 1639 return (_playWarning > 0); | 1637 return (_playWarning > 0); |
| 1640 } | 1638 } |
| 1641 | 1639 |
| 1642 bool AudioDeviceLinuxALSA::PlayoutError() const | 1640 bool AudioDeviceLinuxALSA::PlayoutError() const |
| 1643 { | 1641 { |
| 1644 CriticalSectionScoped lock(&_critSect); | 1642 rtc::CritScope lock(&_critSect); |
| 1645 return (_playError > 0); | 1643 return (_playError > 0); |
| 1646 } | 1644 } |
| 1647 | 1645 |
| 1648 bool AudioDeviceLinuxALSA::RecordingWarning() const | 1646 bool AudioDeviceLinuxALSA::RecordingWarning() const |
| 1649 { | 1647 { |
| 1650 CriticalSectionScoped lock(&_critSect); | 1648 rtc::CritScope lock(&_critSect); |
| 1651 return (_recWarning > 0); | 1649 return (_recWarning > 0); |
| 1652 } | 1650 } |
| 1653 | 1651 |
| 1654 bool AudioDeviceLinuxALSA::RecordingError() const | 1652 bool AudioDeviceLinuxALSA::RecordingError() const |
| 1655 { | 1653 { |
| 1656 CriticalSectionScoped lock(&_critSect); | 1654 rtc::CritScope lock(&_critSect); |
| 1657 return (_recError > 0); | 1655 return (_recError > 0); |
| 1658 } | 1656 } |
| 1659 | 1657 |
| 1660 void AudioDeviceLinuxALSA::ClearPlayoutWarning() | 1658 void AudioDeviceLinuxALSA::ClearPlayoutWarning() |
| 1661 { | 1659 { |
| 1662 CriticalSectionScoped lock(&_critSect); | 1660 rtc::CritScope lock(&_critSect); |
| 1663 _playWarning = 0; | 1661 _playWarning = 0; |
| 1664 } | 1662 } |
| 1665 | 1663 |
| 1666 void AudioDeviceLinuxALSA::ClearPlayoutError() | 1664 void AudioDeviceLinuxALSA::ClearPlayoutError() |
| 1667 { | 1665 { |
| 1668 CriticalSectionScoped lock(&_critSect); | 1666 rtc::CritScope lock(&_critSect); |
| 1669 _playError = 0; | 1667 _playError = 0; |
| 1670 } | 1668 } |
| 1671 | 1669 |
| 1672 void AudioDeviceLinuxALSA::ClearRecordingWarning() | 1670 void AudioDeviceLinuxALSA::ClearRecordingWarning() |
| 1673 { | 1671 { |
| 1674 CriticalSectionScoped lock(&_critSect); | 1672 rtc::CritScope lock(&_critSect); |
| 1675 _recWarning = 0; | 1673 _recWarning = 0; |
| 1676 } | 1674 } |
| 1677 | 1675 |
| 1678 void AudioDeviceLinuxALSA::ClearRecordingError() | 1676 void AudioDeviceLinuxALSA::ClearRecordingError() |
| 1679 { | 1677 { |
| 1680 CriticalSectionScoped lock(&_critSect); | 1678 rtc::CritScope lock(&_critSect); |
| 1681 _recError = 0; | 1679 _recError = 0; |
| 1682 } | 1680 } |
| 1683 | 1681 |
| 1684 // ============================================================================ | 1682 // ============================================================================ |
| 1685 // Private Methods | 1683 // Private Methods |
| 1686 // ============================================================================ | 1684 // ============================================================================ |
| 1687 | 1685 |
| 1688 int32_t AudioDeviceLinuxALSA::GetDevicesInfo( | 1686 int32_t AudioDeviceLinuxALSA::GetDevicesInfo( |
| 1689 const int32_t function, | 1687 const int32_t function, |
| 1690 const bool playback, | 1688 const bool playback, |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2212 state |= (szKey[i] ^ _oldKeyState[i]) & szKey[i]; | 2210 state |= (szKey[i] ^ _oldKeyState[i]) & szKey[i]; |
| 2213 | 2211 |
| 2214 // Save old state | 2212 // Save old state |
| 2215 memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState)); | 2213 memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState)); |
| 2216 return (state != 0); | 2214 return (state != 0); |
| 2217 #else | 2215 #else |
| 2218 return false; | 2216 return false; |
| 2219 #endif | 2217 #endif |
| 2220 } | 2218 } |
| 2221 } // namespace webrtc | 2219 } // namespace webrtc |
| OLD | NEW |