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

Side by Side Diff: webrtc/modules/audio_device/ios/audio_device_ios.h

Issue 1498953002: Reland of "Create rtc::AtomicInt POD struct." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: initializer to audio_device_ios.mm Created 5 years 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 unified diff | Download patch
« no previous file with comments | « webrtc/base/refcount.h ('k') | webrtc/modules/audio_device/ios/audio_device_ios.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef WEBRTC_MODULES_AUDIO_DEVICE_IOS_AUDIO_DEVICE_IOS_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_DEVICE_IOS_AUDIO_DEVICE_IOS_H_
12 #define WEBRTC_MODULES_AUDIO_DEVICE_IOS_AUDIO_DEVICE_IOS_H_ 12 #define WEBRTC_MODULES_AUDIO_DEVICE_IOS_AUDIO_DEVICE_IOS_H_
13 13
14 #include <AudioUnit/AudioUnit.h> 14 #include <AudioUnit/AudioUnit.h>
15 15
16 #include "webrtc/base/atomicops.h"
16 #include "webrtc/base/scoped_ptr.h" 17 #include "webrtc/base/scoped_ptr.h"
17 #include "webrtc/base/thread_checker.h" 18 #include "webrtc/base/thread_checker.h"
18 #include "webrtc/modules/audio_device/audio_device_generic.h" 19 #include "webrtc/modules/audio_device/audio_device_generic.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 22
22 class FineAudioBuffer; 23 class FineAudioBuffer;
23 24
24 // Implements full duplex 16-bit mono PCM audio support for iOS using a 25 // Implements full duplex 16-bit mono PCM audio support for iOS using a
25 // Voice-Processing (VP) I/O audio unit in Core Audio. The VP I/O audio unit 26 // Voice-Processing (VP) I/O audio unit in Core Audio. The VP I/O audio unit
(...skipping 20 matching lines...) Expand all
46 bool Initialized() const override { return initialized_; } 47 bool Initialized() const override { return initialized_; }
47 48
48 int32_t InitPlayout() override; 49 int32_t InitPlayout() override;
49 bool PlayoutIsInitialized() const override { return play_is_initialized_; } 50 bool PlayoutIsInitialized() const override { return play_is_initialized_; }
50 51
51 int32_t InitRecording() override; 52 int32_t InitRecording() override;
52 bool RecordingIsInitialized() const override { return rec_is_initialized_; } 53 bool RecordingIsInitialized() const override { return rec_is_initialized_; }
53 54
54 int32_t StartPlayout() override; 55 int32_t StartPlayout() override;
55 int32_t StopPlayout() override; 56 int32_t StopPlayout() override;
56 bool Playing() const override { return playing_; } 57 bool Playing() const override {
58 return rtc::AtomicInt::AcquireLoad(&playing_) != 0;
59 }
57 60
58 int32_t StartRecording() override; 61 int32_t StartRecording() override;
59 int32_t StopRecording() override; 62 int32_t StopRecording() override;
60 bool Recording() const override { return recording_; } 63 bool Recording() const override {
64 return rtc::AtomicInt::AcquireLoad(&recording_) != 0;
65 }
61 66
62 int32_t SetLoudspeakerStatus(bool enable) override; 67 int32_t SetLoudspeakerStatus(bool enable) override;
63 int32_t GetLoudspeakerStatus(bool& enabled) const override; 68 int32_t GetLoudspeakerStatus(bool& enabled) const override;
64 69
65 // These methods returns hard-coded delay values and not dynamic delay 70 // These methods returns hard-coded delay values and not dynamic delay
66 // estimates. The reason is that iOS supports a built-in AEC and the WebRTC 71 // estimates. The reason is that iOS supports a built-in AEC and the WebRTC
67 // AEC will always be disabled in the Libjingle layer to avoid running two 72 // AEC will always be disabled in the Libjingle layer to avoid running two
68 // AEC implementations at the same time. And, it saves resources to avoid 73 // AEC implementations at the same time. And, it saves resources to avoid
69 // updating these delay values continuously. 74 // updating these delay values continuously.
70 // TODO(henrika): it would be possible to mark these two methods as not 75 // TODO(henrika): it would be possible to mark these two methods as not
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 269
265 // Provides a mechanism for encapsulating one or more buffers of audio data. 270 // Provides a mechanism for encapsulating one or more buffers of audio data.
266 // Only used on the recording side. 271 // Only used on the recording side.
267 AudioBufferList audio_record_buffer_list_; 272 AudioBufferList audio_record_buffer_list_;
268 273
269 // Temporary storage for recorded data. AudioUnitRender() renders into this 274 // Temporary storage for recorded data. AudioUnitRender() renders into this
270 // array as soon as a frame of the desired buffer size has been recorded. 275 // array as soon as a frame of the desired buffer size has been recorded.
271 rtc::scoped_ptr<SInt8[]> record_audio_buffer_; 276 rtc::scoped_ptr<SInt8[]> record_audio_buffer_;
272 277
273 // Set to 1 when recording is active and 0 otherwise. 278 // Set to 1 when recording is active and 0 otherwise.
274 volatile int recording_; 279 rtc::AtomicInt recording_;
275 280
276 // Set to 1 when playout is active and 0 otherwise. 281 // Set to 1 when playout is active and 0 otherwise.
277 volatile int playing_; 282 rtc::AtomicInt playing_;
278 283
279 // Set to true after successful call to Init(), false otherwise. 284 // Set to true after successful call to Init(), false otherwise.
280 bool initialized_; 285 bool initialized_;
281 286
282 // Set to true after successful call to InitRecording(), false otherwise. 287 // Set to true after successful call to InitRecording(), false otherwise.
283 bool rec_is_initialized_; 288 bool rec_is_initialized_;
284 289
285 // Set to true after successful call to InitPlayout(), false otherwise. 290 // Set to true after successful call to InitPlayout(), false otherwise.
286 bool play_is_initialized_; 291 bool play_is_initialized_;
287 292
288 // Audio interruption observer instance. 293 // Audio interruption observer instance.
289 void* audio_interruption_observer_; 294 void* audio_interruption_observer_;
290 void* route_change_observer_; 295 void* route_change_observer_;
291 296
292 // Contains the audio data format specification for a stream of audio. 297 // Contains the audio data format specification for a stream of audio.
293 AudioStreamBasicDescription application_format_; 298 AudioStreamBasicDescription application_format_;
294 }; 299 };
295 300
296 } // namespace webrtc 301 } // namespace webrtc
297 302
298 #endif // WEBRTC_MODULES_AUDIO_DEVICE_IOS_AUDIO_DEVICE_IOS_H_ 303 #endif // WEBRTC_MODULES_AUDIO_DEVICE_IOS_AUDIO_DEVICE_IOS_H_
OLDNEW
« no previous file with comments | « webrtc/base/refcount.h ('k') | webrtc/modules/audio_device/ios/audio_device_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698