Eliminate use of EventWrapper from mac audio device
Bug: webrtc:3380 Change-Id: I9b34588a6a2b035f1787782421e4fc3e6650ef1a Reviewed-on: https://webrtc-review.googlesource.com/c/110244 Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25567}
This commit is contained in:
@ -16,7 +16,6 @@
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/platform_thread.h"
|
||||
#include "rtc_base/system/arch.h"
|
||||
#include "system_wrappers/include/event_wrapper.h"
|
||||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <libkern/OSAtomic.h> // OSAtomicCompareAndSwap()
|
||||
@ -115,8 +114,6 @@ void AudioDeviceMac::logCAMsg(const rtc::LoggingSeverity sev,
|
||||
|
||||
AudioDeviceMac::AudioDeviceMac()
|
||||
: _ptrAudioBuffer(NULL),
|
||||
_stopEventRec(*EventWrapper::Create()),
|
||||
_stopEvent(*EventWrapper::Create()),
|
||||
_mixerManager(),
|
||||
_inputDeviceIndex(0),
|
||||
_outputDeviceIndex(0),
|
||||
@ -153,9 +150,6 @@ AudioDeviceMac::AudioDeviceMac()
|
||||
prev_key_state_() {
|
||||
RTC_LOG(LS_INFO) << __FUNCTION__ << " created";
|
||||
|
||||
RTC_DCHECK(&_stopEvent != NULL);
|
||||
RTC_DCHECK(&_stopEventRec != NULL);
|
||||
|
||||
memset(_renderConvertData, 0, sizeof(_renderConvertData));
|
||||
memset(&_outStreamFormat, 0, sizeof(AudioStreamBasicDescription));
|
||||
memset(&_outDesiredFormat, 0, sizeof(AudioStreamBasicDescription));
|
||||
@ -204,8 +198,6 @@ AudioDeviceMac::~AudioDeviceMac() {
|
||||
RTC_LOG(LS_ERROR) << "semaphore_destroy() error: " << kernErr;
|
||||
}
|
||||
|
||||
delete &_stopEvent;
|
||||
delete &_stopEventRec;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@ -1338,7 +1330,7 @@ int32_t AudioDeviceMac::StopRecording() {
|
||||
_recording = false;
|
||||
_doStopRec = true; // Signal to io proc to stop audio device
|
||||
_critSect.Leave(); // Cannot be under lock, risk of deadlock
|
||||
if (kEventTimeout == _stopEventRec.Wait(2000)) {
|
||||
if (!_stopEventRec.Wait(2000)) {
|
||||
rtc::CritScope critScoped(&_critSect);
|
||||
RTC_LOG(LS_WARNING) << "Timed out stopping the capture IOProc."
|
||||
<< "We may have failed to detect a device removal.";
|
||||
@ -1366,7 +1358,7 @@ int32_t AudioDeviceMac::StopRecording() {
|
||||
_recording = false;
|
||||
_doStop = true; // Signal to io proc to stop audio device
|
||||
_critSect.Leave(); // Cannot be under lock, risk of deadlock
|
||||
if (kEventTimeout == _stopEvent.Wait(2000)) {
|
||||
if (!_stopEvent.Wait(2000)) {
|
||||
rtc::CritScope critScoped(&_critSect);
|
||||
RTC_LOG(LS_WARNING) << "Timed out stopping the shared IOProc."
|
||||
<< "We may have failed to detect a device removal.";
|
||||
@ -1474,7 +1466,7 @@ int32_t AudioDeviceMac::StopPlayout() {
|
||||
_playing = false;
|
||||
_doStop = true; // Signal to io proc to stop audio device
|
||||
_critSect.Leave(); // Cannot be under lock, risk of deadlock
|
||||
if (kEventTimeout == _stopEvent.Wait(2000)) {
|
||||
if (!_stopEvent.Wait(2000)) {
|
||||
rtc::CritScope critScoped(&_critSect);
|
||||
RTC_LOG(LS_WARNING) << "Timed out stopping the render IOProc."
|
||||
<< "We may have failed to detect a device removal.";
|
||||
|
||||
@ -16,9 +16,9 @@
|
||||
#include "modules/audio_device/audio_device_generic.h"
|
||||
#include "modules/audio_device/mac/audio_mixer_manager_mac.h"
|
||||
#include "rtc_base/criticalsection.h"
|
||||
#include "rtc_base/event.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
#include "system_wrappers/include/event_wrapper.h"
|
||||
|
||||
#include <AudioToolbox/AudioConverter.h>
|
||||
#include <CoreAudio/CoreAudio.h>
|
||||
@ -31,7 +31,6 @@ class PlatformThread;
|
||||
} // namespace rtc
|
||||
|
||||
namespace webrtc {
|
||||
class EventWrapper;
|
||||
|
||||
const uint32_t N_REC_SAMPLES_PER_SEC = 48000;
|
||||
const uint32_t N_PLAY_SAMPLES_PER_SEC = 48000;
|
||||
@ -252,8 +251,8 @@ class AudioDeviceMac : public AudioDeviceGeneric {
|
||||
|
||||
rtc::CriticalSection _critSect;
|
||||
|
||||
EventWrapper& _stopEventRec;
|
||||
EventWrapper& _stopEvent;
|
||||
rtc::Event _stopEventRec;
|
||||
rtc::Event _stopEvent;
|
||||
|
||||
// TODO(pbos): Replace with direct members, just start/stop, no need to
|
||||
// recreate the thread.
|
||||
|
||||
Reference in New Issue
Block a user