Index: webrtc/modules/audio_device/ios/audio_device_ios.mm |
diff --git a/webrtc/modules/audio_device/ios/audio_device_ios.mm b/webrtc/modules/audio_device/ios/audio_device_ios.mm |
index 1466d6abca4ee58ce4aa8449adaf0f4a71815e3d..c7b71f3825f3a08442dd17f95b4d9e1982012a76 100644 |
--- a/webrtc/modules/audio_device/ios/audio_device_ios.mm |
+++ b/webrtc/modules/audio_device/ios/audio_device_ios.mm |
@@ -193,8 +193,6 @@ static void LogDeviceInfo() { |
AudioDeviceIOS::AudioDeviceIOS() |
: audio_device_buffer_(nullptr), |
vpio_unit_(nullptr), |
- recording_(0), |
- playing_(0), |
initialized_(false), |
rec_is_initialized_(false), |
play_is_initialized_(false), |
@@ -256,7 +254,7 @@ int32_t AudioDeviceIOS::InitPlayout() { |
RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
RTC_DCHECK(initialized_); |
RTC_DCHECK(!play_is_initialized_); |
- RTC_DCHECK(!playing_); |
+ RTC_DCHECK(!Playing()); |
if (!rec_is_initialized_) { |
if (!InitPlayOrRecord()) { |
LOG_F(LS_ERROR) << "InitPlayOrRecord failed!"; |
@@ -272,7 +270,7 @@ int32_t AudioDeviceIOS::InitRecording() { |
RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
RTC_DCHECK(initialized_); |
RTC_DCHECK(!rec_is_initialized_); |
- RTC_DCHECK(!recording_); |
+ RTC_DCHECK(!Recording()); |
if (!play_is_initialized_) { |
if (!InitPlayOrRecord()) { |
LOG_F(LS_ERROR) << "InitPlayOrRecord failed!"; |
@@ -287,30 +285,30 @@ int32_t AudioDeviceIOS::StartPlayout() { |
LOGI() << "StartPlayout"; |
RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
RTC_DCHECK(play_is_initialized_); |
- RTC_DCHECK(!playing_); |
+ RTC_DCHECK(!Playing()); |
fine_audio_buffer_->ResetPlayout(); |
- if (!recording_) { |
+ if (!Recording()) { |
OSStatus result = AudioOutputUnitStart(vpio_unit_); |
if (result != noErr) { |
LOG_F(LS_ERROR) << "AudioOutputUnitStart failed: " << result; |
return -1; |
} |
} |
- rtc::AtomicOps::ReleaseStore(&playing_, 1); |
+ rtc::AtomicInt::ReleaseStore(&playing_, 1); |
return 0; |
} |
int32_t AudioDeviceIOS::StopPlayout() { |
LOGI() << "StopPlayout"; |
RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
- if (!play_is_initialized_ || !playing_) { |
+ if (!play_is_initialized_ || !Playing()) { |
return 0; |
} |
- if (!recording_) { |
+ if (!Recording()) { |
ShutdownPlayOrRecord(); |
} |
play_is_initialized_ = false; |
- rtc::AtomicOps::ReleaseStore(&playing_, 0); |
+ rtc::AtomicInt::ReleaseStore(&playing_, 0); |
return 0; |
} |
@@ -318,30 +316,30 @@ int32_t AudioDeviceIOS::StartRecording() { |
LOGI() << "StartRecording"; |
RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
RTC_DCHECK(rec_is_initialized_); |
- RTC_DCHECK(!recording_); |
+ RTC_DCHECK(!Recording()); |
fine_audio_buffer_->ResetRecord(); |
- if (!playing_) { |
+ if (!Playing()) { |
OSStatus result = AudioOutputUnitStart(vpio_unit_); |
if (result != noErr) { |
LOG_F(LS_ERROR) << "AudioOutputUnitStart failed: " << result; |
return -1; |
} |
} |
- rtc::AtomicOps::ReleaseStore(&recording_, 1); |
+ rtc::AtomicInt::ReleaseStore(&recording_, 1); |
return 0; |
} |
int32_t AudioDeviceIOS::StopRecording() { |
LOGI() << "StopRecording"; |
RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
- if (!rec_is_initialized_ || !recording_) { |
+ if (!rec_is_initialized_ || !Recording()) { |
return 0; |
} |
- if (!playing_) { |
+ if (!Playing()) { |
ShutdownPlayOrRecord(); |
} |
rec_is_initialized_ = false; |
- rtc::AtomicOps::ReleaseStore(&recording_, 0); |
+ rtc::AtomicInt::ReleaseStore(&recording_, 0); |
return 0; |
} |
@@ -851,7 +849,7 @@ OSStatus AudioDeviceIOS::OnRecordedDataIsAvailable( |
UInt32 in_number_frames) { |
OSStatus result = noErr; |
// Simply return if recording is not enabled. |
- if (!rtc::AtomicOps::AcquireLoad(&recording_)) |
+ if (!Recording()) |
return result; |
if (in_number_frames != record_parameters_.frames_per_buffer()) { |
// We have seen short bursts (1-2 frames) where |in_number_frames| changes. |
@@ -910,7 +908,7 @@ OSStatus AudioDeviceIOS::OnGetPlayoutData( |
SInt8* destination = static_cast<SInt8*>(io_data->mBuffers[0].mData); |
// Produce silence and give audio unit a hint about it if playout is not |
// activated. |
- if (!rtc::AtomicOps::AcquireLoad(&playing_)) { |
+ if (!Playing()) { |
*io_action_flags |= kAudioUnitRenderAction_OutputIsSilence; |
memset(destination, 0, dataSizeInBytes); |
return noErr; |