| 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 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 } | 1940 } |
| 1941 | 1941 |
| 1942 return tmpLatency; | 1942 return tmpLatency; |
| 1943 } else { | 1943 } else { |
| 1944 return (int32_t)latency; | 1944 return (int32_t)latency; |
| 1945 } | 1945 } |
| 1946 } | 1946 } |
| 1947 | 1947 |
| 1948 int32_t AudioDeviceLinuxPulse::ReadRecordedData(const void* bufferData, | 1948 int32_t AudioDeviceLinuxPulse::ReadRecordedData(const void* bufferData, |
| 1949 size_t bufferSize) | 1949 size_t bufferSize) |
| 1950 EXCLUSIVE_LOCKS_REQUIRED(_critSect) { | 1950 RTC_EXCLUSIVE_LOCKS_REQUIRED(_critSect) { |
| 1951 size_t size = bufferSize; | 1951 size_t size = bufferSize; |
| 1952 uint32_t numRecSamples = _recordBufferSize / (2 * _recChannels); | 1952 uint32_t numRecSamples = _recordBufferSize / (2 * _recChannels); |
| 1953 | 1953 |
| 1954 // Account for the peeked data and the used data. | 1954 // Account for the peeked data and the used data. |
| 1955 uint32_t recDelay = | 1955 uint32_t recDelay = |
| 1956 (uint32_t)((LatencyUsecs(_recStream) / 1000) + | 1956 (uint32_t)((LatencyUsecs(_recStream) / 1000) + |
| 1957 10 * ((size + _recordBufferUsed) / _recordBufferSize)); | 1957 10 * ((size + _recordBufferUsed) / _recordBufferSize)); |
| 1958 | 1958 |
| 1959 _sndCardRecDelay = recDelay; | 1959 _sndCardRecDelay = recDelay; |
| 1960 | 1960 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 memcpy(_recBuffer, bufferData, size); | 2010 memcpy(_recBuffer, bufferData, size); |
| 2011 _recordBufferUsed = size; | 2011 _recordBufferUsed = size; |
| 2012 } | 2012 } |
| 2013 | 2013 |
| 2014 return 0; | 2014 return 0; |
| 2015 } | 2015 } |
| 2016 | 2016 |
| 2017 int32_t AudioDeviceLinuxPulse::ProcessRecordedData(int8_t* bufferData, | 2017 int32_t AudioDeviceLinuxPulse::ProcessRecordedData(int8_t* bufferData, |
| 2018 uint32_t bufferSizeInSamples, | 2018 uint32_t bufferSizeInSamples, |
| 2019 uint32_t recDelay) | 2019 uint32_t recDelay) |
| 2020 EXCLUSIVE_LOCKS_REQUIRED(_critSect) { | 2020 RTC_EXCLUSIVE_LOCKS_REQUIRED(_critSect) { |
| 2021 uint32_t currentMicLevel(0); | 2021 uint32_t currentMicLevel(0); |
| 2022 uint32_t newMicLevel(0); | 2022 uint32_t newMicLevel(0); |
| 2023 | 2023 |
| 2024 _ptrAudioBuffer->SetRecordedBuffer(bufferData, bufferSizeInSamples); | 2024 _ptrAudioBuffer->SetRecordedBuffer(bufferData, bufferSizeInSamples); |
| 2025 | 2025 |
| 2026 if (AGC()) { | 2026 if (AGC()) { |
| 2027 // Store current mic level in the audio buffer if AGC is enabled | 2027 // Store current mic level in the audio buffer if AGC is enabled |
| 2028 if (MicrophoneVolume(currentMicLevel) == 0) { | 2028 if (MicrophoneVolume(currentMicLevel) == 0) { |
| 2029 // This call does not affect the actual microphone volume | 2029 // This call does not affect the actual microphone volume |
| 2030 _ptrAudioBuffer->SetCurrentMicLevel(currentMicLevel); | 2030 _ptrAudioBuffer->SetCurrentMicLevel(currentMicLevel); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2398 | 2398 |
| 2399 // A bit change in keymap means a key is pressed | 2399 // A bit change in keymap means a key is pressed |
| 2400 for (i = 0; i < sizeof(szKey); i++) | 2400 for (i = 0; i < sizeof(szKey); i++) |
| 2401 state |= (szKey[i] ^ _oldKeyState[i]) & szKey[i]; | 2401 state |= (szKey[i] ^ _oldKeyState[i]) & szKey[i]; |
| 2402 | 2402 |
| 2403 // Save old state | 2403 // Save old state |
| 2404 memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState)); | 2404 memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState)); |
| 2405 return (state != 0); | 2405 return (state != 0); |
| 2406 } | 2406 } |
| 2407 } // namespace webrtc | 2407 } // namespace webrtc |
| OLD | NEW |