OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 static const size_t kNumberBytesPerSample = sizeof(Sample); | 45 static const size_t kNumberBytesPerSample = sizeof(Sample); |
46 | 46 |
47 // Creates a FakeAudioCaptureModule or returns NULL on failure. | 47 // Creates a FakeAudioCaptureModule or returns NULL on failure. |
48 static rtc::scoped_refptr<FakeAudioCaptureModule> Create(); | 48 static rtc::scoped_refptr<FakeAudioCaptureModule> Create(); |
49 | 49 |
50 // Returns the number of frames that have been successfully pulled by the | 50 // Returns the number of frames that have been successfully pulled by the |
51 // instance. Note that correctly detecting success can only be done if the | 51 // instance. Note that correctly detecting success can only be done if the |
52 // pulled frame was generated/pushed from a FakeAudioCaptureModule. | 52 // pulled frame was generated/pushed from a FakeAudioCaptureModule. |
53 int frames_received() const; | 53 int frames_received() const; |
54 | 54 |
55 // Following functions are inherited from webrtc::AudioDeviceModule. | |
56 // Only functions called by PeerConnection are implemented, the rest do | |
57 // nothing and return success. If a function is not expected to be called by | |
58 // PeerConnection an assertion is triggered if it is in fact called. | |
59 int64_t TimeUntilNextProcess() override; | |
60 void Process() override; | |
61 | |
62 int32_t ActiveAudioLayer(AudioLayer* audio_layer) const override; | 55 int32_t ActiveAudioLayer(AudioLayer* audio_layer) const override; |
63 | 56 |
64 ErrorCode LastError() const override; | 57 ErrorCode LastError() const override; |
65 int32_t RegisterEventObserver( | |
66 webrtc::AudioDeviceObserver* event_callback) override; | |
67 | 58 |
68 // Note: Calling this method from a callback may result in deadlock. | 59 // Note: Calling this method from a callback may result in deadlock. |
69 int32_t RegisterAudioCallback( | 60 int32_t RegisterAudioCallback( |
70 webrtc::AudioTransport* audio_callback) override; | 61 webrtc::AudioTransport* audio_callback) override; |
71 | 62 |
72 int32_t Init() override; | 63 int32_t Init() override; |
73 int32_t Terminate() override; | 64 int32_t Terminate() override; |
74 bool Initialized() const override; | 65 bool Initialized() const override; |
75 | 66 |
76 int16_t PlayoutDevices() override; | 67 int16_t PlayoutDevices() override; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // Starts the periodic calling of ProcessFrame() in a thread safe way. | 194 // Starts the periodic calling of ProcessFrame() in a thread safe way. |
204 void StartProcessP(); | 195 void StartProcessP(); |
205 // Periodcally called function that ensures that frames are pulled and pushed | 196 // Periodcally called function that ensures that frames are pulled and pushed |
206 // periodically if enabled/started. | 197 // periodically if enabled/started. |
207 void ProcessFrameP(); | 198 void ProcessFrameP(); |
208 // Pulls frames from the registered webrtc::AudioTransport. | 199 // Pulls frames from the registered webrtc::AudioTransport. |
209 void ReceiveFrameP(); | 200 void ReceiveFrameP(); |
210 // Pushes frames to the registered webrtc::AudioTransport. | 201 // Pushes frames to the registered webrtc::AudioTransport. |
211 void SendFrameP(); | 202 void SendFrameP(); |
212 | 203 |
213 // The time in milliseconds when Process() was last called or 0 if no call | |
214 // has been made. | |
215 int64_t last_process_time_ms_; | |
216 | |
217 // Callback for playout and recording. | 204 // Callback for playout and recording. |
218 webrtc::AudioTransport* audio_callback_; | 205 webrtc::AudioTransport* audio_callback_; |
219 | 206 |
220 bool recording_; // True when audio is being pushed from the instance. | 207 bool recording_; // True when audio is being pushed from the instance. |
221 bool playing_; // True when audio is being pulled by the instance. | 208 bool playing_; // True when audio is being pulled by the instance. |
222 | 209 |
223 bool play_is_initialized_; // True when the instance is ready to pull audio. | 210 bool play_is_initialized_; // True when the instance is ready to pull audio. |
224 bool rec_is_initialized_; // True when the instance is ready to push audio. | 211 bool rec_is_initialized_; // True when the instance is ready to push audio. |
225 | 212 |
226 // Input to and output from RecordedDataIsAvailable(..) makes it possible to | 213 // Input to and output from RecordedDataIsAvailable(..) makes it possible to |
(...skipping 21 matching lines...) Expand all Loading... |
248 | 235 |
249 // Protects variables that are accessed from process_thread_ and | 236 // Protects variables that are accessed from process_thread_ and |
250 // the main thread. | 237 // the main thread. |
251 rtc::CriticalSection crit_; | 238 rtc::CriticalSection crit_; |
252 // Protects |audio_callback_| that is accessed from process_thread_ and | 239 // Protects |audio_callback_| that is accessed from process_thread_ and |
253 // the main thread. | 240 // the main thread. |
254 rtc::CriticalSection crit_callback_; | 241 rtc::CriticalSection crit_callback_; |
255 }; | 242 }; |
256 | 243 |
257 #endif // PC_TEST_FAKEAUDIOCAPTUREMODULE_H_ | 244 #endif // PC_TEST_FAKEAUDIOCAPTUREMODULE_H_ |
OLD | NEW |