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

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

Issue 1822543002: Support delayed AudioUnit initialization. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 months 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
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 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
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // as the Remote I/O unit (supports full duplex low-latency audio input and 42 // as the Remote I/O unit (supports full duplex low-latency audio input and
43 // output) and adds AEC for for two-way duplex communication. It also adds AGC, 43 // output) and adds AEC for for two-way duplex communication. It also adds AGC,
44 // adjustment of voice-processing quality, and muting. Hence, ideal for 44 // adjustment of voice-processing quality, and muting. Hence, ideal for
45 // VoIP applications. 45 // VoIP applications.
46 class VoiceProcessingAudioUnit { 46 class VoiceProcessingAudioUnit {
47 public: 47 public:
48 explicit VoiceProcessingAudioUnit(VoiceProcessingAudioUnitObserver* observer); 48 explicit VoiceProcessingAudioUnit(VoiceProcessingAudioUnitObserver* observer);
49 ~VoiceProcessingAudioUnit(); 49 ~VoiceProcessingAudioUnit();
50 50
51 // TODO(tkchin): enum for state and state checking. 51 // TODO(tkchin): enum for state and state checking.
52 enum State : int32_t {
53 // Init() should be called.
54 kInitRequired,
55 // Audio unit created but not initialized.
56 kUninitialized,
57 // Initialized but not started. Equivalent to stopped.
58 kInitialized,
59 // Initialized and started.
60 kStarted,
61 };
52 62
53 // Number of bytes per audio sample for 16-bit signed integer representation. 63 // Number of bytes per audio sample for 16-bit signed integer representation.
54 static const UInt32 kBytesPerSample; 64 static const UInt32 kBytesPerSample;
55 65
56 // Initializes this class by creating the underlying audio unit instance. 66 // Initializes this class by creating the underlying audio unit instance.
57 // Creates a Voice-Processing I/O unit and configures it for full-duplex 67 // Creates a Voice-Processing I/O unit and configures it for full-duplex
58 // audio. The selected stream format is selected to avoid internal resampling 68 // audio. The selected stream format is selected to avoid internal resampling
59 // and to match the 10ms callback rate for WebRTC as well as possible. 69 // and to match the 10ms callback rate for WebRTC as well as possible.
60 // Does not intialize the audio unit. 70 // Does not intialize the audio unit.
61 bool Init(); 71 bool Init();
62 72
73 VoiceProcessingAudioUnit::State GetState() const;
74
63 // Initializes the underlying audio unit with the given sample rate. 75 // Initializes the underlying audio unit with the given sample rate.
64 bool Initialize(Float64 sample_rate); 76 bool Initialize(Float64 sample_rate);
65 77
66 // Starts the underlying audio unit. 78 // Starts the underlying audio unit.
67 bool Start(); 79 bool Start();
68 80
69 // Stops the underlying audio unit. 81 // Stops the underlying audio unit.
70 bool Stop(); 82 bool Stop();
71 83
72 // Uninitializes the underlying audio unit. 84 // Uninitializes the underlying audio unit.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 123
112 // Returns the predetermined format with a specific sample rate. See 124 // Returns the predetermined format with a specific sample rate. See
113 // implementation file for details on format. 125 // implementation file for details on format.
114 AudioStreamBasicDescription GetFormat(Float64 sample_rate) const; 126 AudioStreamBasicDescription GetFormat(Float64 sample_rate) const;
115 127
116 // Deletes the underlying audio unit. 128 // Deletes the underlying audio unit.
117 void DisposeAudioUnit(); 129 void DisposeAudioUnit();
118 130
119 VoiceProcessingAudioUnitObserver* observer_; 131 VoiceProcessingAudioUnitObserver* observer_;
120 AudioUnit vpio_unit_; 132 AudioUnit vpio_unit_;
133 VoiceProcessingAudioUnit::State state_;
121 }; 134 };
122 } // namespace webrtc 135 } // namespace webrtc
123 136
124 #endif // WEBRTC_MODULES_AUDIO_DEVICE_IOS_VOICE_PROCESSING_AUDIO_UNIT_H_ 137 #endif // WEBRTC_MODULES_AUDIO_DEVICE_IOS_VOICE_PROCESSING_AUDIO_UNIT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698