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