Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1865)

Unified Diff: webrtc/modules/audio_device/ios/audio_device_ios.mm

Issue 1420043008: Create rtc::AtomicInt POD struct. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: intentional obliteration of the unintentional whitespace of doom Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_device/ios/audio_device_ios.h ('k') | webrtc/modules/pacing/packet_router.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « webrtc/modules/audio_device/ios/audio_device_ios.h ('k') | webrtc/modules/pacing/packet_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698