diff options
author | Erwin Jansen <jansene@google.com> | 2021-06-23 05:52:25 -0700 |
---|---|---|
committer | Erwin Jansen <jansene@google.com> | 2021-06-23 06:45:54 -0700 |
commit | 16be34ae72cdb525c88c2b31b21b976f35fe36d8 (patch) | |
tree | 6eacaffe4bebf8e00c290c1e1839e084b0c52e88 /modules/audio_device/mac/audio_device_mac.cc | |
parent | 97e54a7e73c7b24e464ef06ef3c3b3716f21bb15 (diff) | |
parent | 49cb4599560d6005d5df0dadfca2db04b288f216 (diff) | |
download | webrtc-16be34ae72cdb525c88c2b31b21b976f35fe36d8.tar.gz |
Merge upstream-master and enable ARM64
We bring in the latest WebRTC changes and turn on arm.
This adds a new third party lib: crc32c, and includes a workaround
for handling a depencency issue for arm.
Bug: 191745658
Change-Id: Ic5be99911990ef14a5f733f19394032b20f85024
Diffstat (limited to 'modules/audio_device/mac/audio_device_mac.cc')
-rw-r--r-- | modules/audio_device/mac/audio_device_mac.cc | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/modules/audio_device/mac/audio_device_mac.cc b/modules/audio_device/mac/audio_device_mac.cc index f1ee4251fa..2088b017a0 100644 --- a/modules/audio_device/mac/audio_device_mac.cc +++ b/modules/audio_device/mac/audio_device_mac.cc @@ -166,8 +166,8 @@ AudioDeviceMac::~AudioDeviceMac() { Terminate(); } - RTC_DCHECK(!capture_worker_thread_.get()); - RTC_DCHECK(!render_worker_thread_.get()); + RTC_DCHECK(capture_worker_thread_.empty()); + RTC_DCHECK(render_worker_thread_.empty()); if (_paRenderBuffer) { delete _paRenderBuffer; @@ -1308,11 +1308,14 @@ int32_t AudioDeviceMac::StartRecording() { return -1; } - RTC_DCHECK(!capture_worker_thread_.get()); - capture_worker_thread_.reset(new rtc::PlatformThread( - RunCapture, this, "CaptureWorkerThread", rtc::kRealtimePriority)); - RTC_DCHECK(capture_worker_thread_.get()); - capture_worker_thread_->Start(); + RTC_DCHECK(capture_worker_thread_.empty()); + capture_worker_thread_ = rtc::PlatformThread::SpawnJoinable( + [this] { + while (CaptureWorkerThread()) { + } + }, + "CaptureWorkerThread", + rtc::ThreadAttributes().SetPriority(rtc::ThreadPriority::kRealtime)); OSStatus err = noErr; if (_twoDevices) { @@ -1394,10 +1397,9 @@ int32_t AudioDeviceMac::StopRecording() { // Setting this signal will allow the worker thread to be stopped. AtomicSet32(&_captureDeviceIsAlive, 0); - if (capture_worker_thread_.get()) { + if (!capture_worker_thread_.empty()) { mutex_.Unlock(); - capture_worker_thread_->Stop(); - capture_worker_thread_.reset(); + capture_worker_thread_.Finalize(); mutex_.Lock(); } @@ -1443,10 +1445,14 @@ int32_t AudioDeviceMac::StartPlayout() { return 0; } - RTC_DCHECK(!render_worker_thread_.get()); - render_worker_thread_.reset(new rtc::PlatformThread( - RunRender, this, "RenderWorkerThread", rtc::kRealtimePriority)); - render_worker_thread_->Start(); + RTC_DCHECK(render_worker_thread_.empty()); + render_worker_thread_ = rtc::PlatformThread::SpawnJoinable( + [this] { + while (RenderWorkerThread()) { + } + }, + "RenderWorkerThread", + rtc::ThreadAttributes().SetPriority(rtc::ThreadPriority::kRealtime)); if (_twoDevices || !_recording) { OSStatus err = noErr; @@ -1504,10 +1510,9 @@ int32_t AudioDeviceMac::StopPlayout() { // Setting this signal will allow the worker thread to be stopped. AtomicSet32(&_renderDeviceIsAlive, 0); - if (render_worker_thread_.get()) { + if (!render_worker_thread_.empty()) { mutex_.Unlock(); - render_worker_thread_->Stop(); - render_worker_thread_.reset(); + render_worker_thread_.Finalize(); mutex_.Lock(); } @@ -2369,12 +2374,6 @@ OSStatus AudioDeviceMac::implInConverterProc(UInt32* numberDataPackets, return 0; } -void AudioDeviceMac::RunRender(void* ptrThis) { - AudioDeviceMac* device = static_cast<AudioDeviceMac*>(ptrThis); - while (device->RenderWorkerThread()) { - } -} - bool AudioDeviceMac::RenderWorkerThread() { PaRingBufferSize numSamples = ENGINE_PLAY_BUF_SIZE_IN_SAMPLES * _outDesiredFormat.mChannelsPerFrame; @@ -2440,12 +2439,6 @@ bool AudioDeviceMac::RenderWorkerThread() { return true; } -void AudioDeviceMac::RunCapture(void* ptrThis) { - AudioDeviceMac* device = static_cast<AudioDeviceMac*>(ptrThis); - while (device->CaptureWorkerThread()) { - } -} - bool AudioDeviceMac::CaptureWorkerThread() { OSStatus err = noErr; UInt32 noRecSamples = |