| 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/refcount.h" | 11 #include "webrtc/base/refcount.h" | 
|  | 12 #include "webrtc/base/timeutils.h" | 
| 12 #include "webrtc/base/trace_event.h" | 13 #include "webrtc/base/trace_event.h" | 
| 13 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
      y.h" | 14 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
      y.h" | 
| 14 #include "webrtc/modules/audio_device/audio_device_config.h" | 15 #include "webrtc/modules/audio_device/audio_device_config.h" | 
| 15 #include "webrtc/modules/audio_device/audio_device_impl.h" | 16 #include "webrtc/modules/audio_device/audio_device_impl.h" | 
| 16 #include "webrtc/system_wrappers/include/tick_util.h" |  | 
| 17 | 17 | 
| 18 #include <assert.h> | 18 #include <assert.h> | 
| 19 #include <string.h> | 19 #include <string.h> | 
| 20 | 20 | 
| 21 #if defined(_WIN32) | 21 #if defined(_WIN32) | 
| 22     #include "audio_device_wave_win.h" | 22     #include "audio_device_wave_win.h" | 
| 23  #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) | 23  #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) | 
| 24     #include "audio_device_core_win.h" | 24     #include "audio_device_core_win.h" | 
| 25  #endif | 25  #endif | 
| 26 #elif defined(WEBRTC_ANDROID) | 26 #elif defined(WEBRTC_ANDROID) | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 116 // ---------------------------------------------------------------------------- | 116 // ---------------------------------------------------------------------------- | 
| 117 | 117 | 
| 118 AudioDeviceModuleImpl::AudioDeviceModuleImpl(const int32_t id, const AudioLayer 
      audioLayer) : | 118 AudioDeviceModuleImpl::AudioDeviceModuleImpl(const int32_t id, const AudioLayer 
      audioLayer) : | 
| 119     _critSect(*CriticalSectionWrapper::CreateCriticalSection()), | 119     _critSect(*CriticalSectionWrapper::CreateCriticalSection()), | 
| 120     _critSectEventCb(*CriticalSectionWrapper::CreateCriticalSection()), | 120     _critSectEventCb(*CriticalSectionWrapper::CreateCriticalSection()), | 
| 121     _critSectAudioCb(*CriticalSectionWrapper::CreateCriticalSection()), | 121     _critSectAudioCb(*CriticalSectionWrapper::CreateCriticalSection()), | 
| 122     _ptrCbAudioDeviceObserver(NULL), | 122     _ptrCbAudioDeviceObserver(NULL), | 
| 123     _ptrAudioDevice(NULL), | 123     _ptrAudioDevice(NULL), | 
| 124     _id(id), | 124     _id(id), | 
| 125     _platformAudioLayer(audioLayer), | 125     _platformAudioLayer(audioLayer), | 
| 126     _lastProcessTime(TickTime::MillisecondTimestamp()), | 126     _lastProcessTime(rtc::TimeMillis()), | 
| 127     _platformType(kPlatformNotSupported), | 127     _platformType(kPlatformNotSupported), | 
| 128     _initialized(false), | 128     _initialized(false), | 
| 129     _lastError(kAdmErrNone) | 129     _lastError(kAdmErrNone) | 
| 130 { | 130 { | 
| 131     WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, id, "%s created", __FUNCTION__
      ); | 131     WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, id, "%s created", __FUNCTION__
      ); | 
| 132 } | 132 } | 
| 133 | 133 | 
| 134 // ---------------------------------------------------------------------------- | 134 // ---------------------------------------------------------------------------- | 
| 135 //  CheckPlatform | 135 //  CheckPlatform | 
| 136 // ---------------------------------------------------------------------------- | 136 // ---------------------------------------------------------------------------- | 
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 400 | 400 | 
| 401 // ---------------------------------------------------------------------------- | 401 // ---------------------------------------------------------------------------- | 
| 402 //  Module::TimeUntilNextProcess | 402 //  Module::TimeUntilNextProcess | 
| 403 // | 403 // | 
| 404 //  Returns the number of milliseconds until the module want a worker thread | 404 //  Returns the number of milliseconds until the module want a worker thread | 
| 405 //  to call Process(). | 405 //  to call Process(). | 
| 406 // ---------------------------------------------------------------------------- | 406 // ---------------------------------------------------------------------------- | 
| 407 | 407 | 
| 408 int64_t AudioDeviceModuleImpl::TimeUntilNextProcess() | 408 int64_t AudioDeviceModuleImpl::TimeUntilNextProcess() | 
| 409 { | 409 { | 
| 410     int64_t now = TickTime::MillisecondTimestamp(); | 410     int64_t now = rtc::TimeMillis(); | 
| 411     int64_t deltaProcess = kAdmMaxIdleTimeProcess - (now - _lastProcessTime); | 411     int64_t deltaProcess = kAdmMaxIdleTimeProcess - (now - _lastProcessTime); | 
| 412     return deltaProcess; | 412     return deltaProcess; | 
| 413 } | 413 } | 
| 414 | 414 | 
| 415 // ---------------------------------------------------------------------------- | 415 // ---------------------------------------------------------------------------- | 
| 416 //  Module::Process | 416 //  Module::Process | 
| 417 // | 417 // | 
| 418 //  Check for posted error and warning reports. Generate callbacks if | 418 //  Check for posted error and warning reports. Generate callbacks if | 
| 419 //  new reports exists. | 419 //  new reports exists. | 
| 420 // ---------------------------------------------------------------------------- | 420 // ---------------------------------------------------------------------------- | 
| 421 | 421 | 
| 422 void AudioDeviceModuleImpl::Process() | 422 void AudioDeviceModuleImpl::Process() | 
| 423 { | 423 { | 
| 424 | 424 | 
| 425     _lastProcessTime = TickTime::MillisecondTimestamp(); | 425     _lastProcessTime = rtc::TimeMillis(); | 
| 426 | 426 | 
| 427     // kPlayoutWarning | 427     // kPlayoutWarning | 
| 428     if (_ptrAudioDevice->PlayoutWarning()) | 428     if (_ptrAudioDevice->PlayoutWarning()) | 
| 429     { | 429     { | 
| 430         CriticalSectionScoped lock(&_critSectEventCb); | 430         CriticalSectionScoped lock(&_critSectEventCb); | 
| 431         if (_ptrCbAudioDeviceObserver) | 431         if (_ptrCbAudioDeviceObserver) | 
| 432         { | 432         { | 
| 433             WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, "=> OnWarningIsR
      eported(kPlayoutWarning)"); | 433             WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, "=> OnWarningIsR
      eported(kPlayoutWarning)"); | 
| 434             _ptrCbAudioDeviceObserver->OnWarningIsReported(AudioDeviceObserver::
      kPlayoutWarning); | 434             _ptrCbAudioDeviceObserver->OnWarningIsReported(AudioDeviceObserver::
      kPlayoutWarning); | 
| 435         } | 435         } | 
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1930 // ---------------------------------------------------------------------------- | 1930 // ---------------------------------------------------------------------------- | 
| 1931 //  PlatformAudioLayer | 1931 //  PlatformAudioLayer | 
| 1932 // ---------------------------------------------------------------------------- | 1932 // ---------------------------------------------------------------------------- | 
| 1933 | 1933 | 
| 1934 AudioDeviceModule::AudioLayer AudioDeviceModuleImpl::PlatformAudioLayer() const | 1934 AudioDeviceModule::AudioLayer AudioDeviceModuleImpl::PlatformAudioLayer() const | 
| 1935 { | 1935 { | 
| 1936     return _platformAudioLayer; | 1936     return _platformAudioLayer; | 
| 1937 } | 1937 } | 
| 1938 | 1938 | 
| 1939 }  // namespace webrtc | 1939 }  // namespace webrtc | 
| OLD | NEW | 
|---|