| 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 |
| 11 #include "webrtc/base/timeutils.h" |
| 11 #include "webrtc/modules/audio_device/audio_device_config.h" | 12 #include "webrtc/modules/audio_device/audio_device_config.h" |
| 12 #include "webrtc/modules/audio_device/win/audio_device_wave_win.h" | 13 #include "webrtc/modules/audio_device/win/audio_device_wave_win.h" |
| 13 | 14 |
| 14 #include "webrtc/system_wrappers/include/event_wrapper.h" | 15 #include "webrtc/system_wrappers/include/event_wrapper.h" |
| 15 #include "webrtc/system_wrappers/include/tick_util.h" | |
| 16 #include "webrtc/system_wrappers/include/trace.h" | 16 #include "webrtc/system_wrappers/include/trace.h" |
| 17 | 17 |
| 18 #include <windows.h> | 18 #include <windows.h> |
| 19 #include <objbase.h> // CoTaskMemAlloc, CoTaskMemFree | 19 #include <objbase.h> // CoTaskMemAlloc, CoTaskMemFree |
| 20 #include <strsafe.h> // StringCchCopy(), StringCchCat(), StringCchPrintf() | 20 #include <strsafe.h> // StringCchCopy(), StringCchCat(), StringCchPrintf() |
| 21 #include <assert.h> | 21 #include <assert.h> |
| 22 | 22 |
| 23 // Avoids the need of Windows 7 SDK | 23 // Avoids the need of Windows 7 SDK |
| 24 #ifndef WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE | 24 #ifndef WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE |
| 25 #define WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE 0x0010 | 25 #define WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE 0x0010 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 int32_t AudioDeviceWindowsWave::Init() | 199 int32_t AudioDeviceWindowsWave::Init() |
| 200 { | 200 { |
| 201 | 201 |
| 202 CriticalSectionScoped lock(&_critSect); | 202 CriticalSectionScoped lock(&_critSect); |
| 203 | 203 |
| 204 if (_initialized) | 204 if (_initialized) |
| 205 { | 205 { |
| 206 return 0; | 206 return 0; |
| 207 } | 207 } |
| 208 | 208 |
| 209 const uint32_t nowTime(TickTime::MillisecondTimestamp()); | 209 const uint32_t nowTime(rtc::TimeMillis()); |
| 210 | 210 |
| 211 _recordedBytes = 0; | 211 _recordedBytes = 0; |
| 212 _prevRecByteCheckTime = nowTime; | 212 _prevRecByteCheckTime = nowTime; |
| 213 _prevRecTime = nowTime; | 213 _prevRecTime = nowTime; |
| 214 _prevPlayTime = nowTime; | 214 _prevPlayTime = nowTime; |
| 215 _prevTimerCheckTime = nowTime; | 215 _prevTimerCheckTime = nowTime; |
| 216 | 216 |
| 217 _playWarning = 0; | 217 _playWarning = 0; |
| 218 _playError = 0; | 218 _playError = 0; |
| 219 _recWarning = 0; | 219 _recWarning = 0; |
| (...skipping 2811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3031 break; | 3031 break; |
| 3032 case kEventError: | 3032 case kEventError: |
| 3033 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, "EventWrapper::Wait(
) failed => restarting timer"); | 3033 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, "EventWrapper::Wait(
) failed => restarting timer"); |
| 3034 _timeEvent.StopTimer(); | 3034 _timeEvent.StopTimer(); |
| 3035 _timeEvent.StartTimer(true, TIMER_PERIOD_MS); | 3035 _timeEvent.StartTimer(true, TIMER_PERIOD_MS); |
| 3036 return true; | 3036 return true; |
| 3037 case kEventTimeout: | 3037 case kEventTimeout: |
| 3038 return true; | 3038 return true; |
| 3039 } | 3039 } |
| 3040 | 3040 |
| 3041 time = TickTime::MillisecondTimestamp(); | 3041 time = rtc::TimeMillis(); |
| 3042 | 3042 |
| 3043 if (_startPlay) | 3043 if (_startPlay) |
| 3044 { | 3044 { |
| 3045 if (PrepareStartPlayout() == 0) | 3045 if (PrepareStartPlayout() == 0) |
| 3046 { | 3046 { |
| 3047 _prevTimerCheckTime = time; | 3047 _prevTimerCheckTime = time; |
| 3048 _prevPlayTime = time; | 3048 _prevPlayTime = time; |
| 3049 _startPlay = false; | 3049 _startPlay = false; |
| 3050 _playing = true; | 3050 _playing = true; |
| 3051 _playStartEvent.Set(); | 3051 _playStartEvent.Set(); |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3723 bool AudioDeviceWindowsWave::KeyPressed() const{ | 3723 bool AudioDeviceWindowsWave::KeyPressed() const{ |
| 3724 | 3724 |
| 3725 int key_down = 0; | 3725 int key_down = 0; |
| 3726 for (int key = VK_SPACE; key < VK_NUMLOCK; key++) { | 3726 for (int key = VK_SPACE; key < VK_NUMLOCK; key++) { |
| 3727 short res = GetAsyncKeyState(key); | 3727 short res = GetAsyncKeyState(key); |
| 3728 key_down |= res & 0x1; // Get the LSB | 3728 key_down |= res & 0x1; // Get the LSB |
| 3729 } | 3729 } |
| 3730 return (key_down > 0); | 3730 return (key_down > 0); |
| 3731 } | 3731 } |
| 3732 } // namespace webrtc | 3732 } // namespace webrtc |
| OLD | NEW |