henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * libjingle |
jlmiller@webrtc.org | 5f93d0a | 2015-01-20 21:36:13 +0000 | [diff] [blame] | 3 | * Copyright 2012 Google Inc. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions are met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright notice, |
| 9 | * this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer in the documentation |
| 12 | * and/or other materials provided with the distribution. |
| 13 | * 3. The name of the author may not be used to endorse or promote products |
| 14 | * derived from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
| 19 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | // This class implements an AudioCaptureModule that can be used to detect if |
| 29 | // audio is being received properly if it is fed by another AudioCaptureModule |
| 30 | // in some arbitrary audio pipeline where they are connected. It does not play |
| 31 | // out or record any audio so it does not need access to any hardware and can |
| 32 | // therefore be used in the gtest testing framework. |
| 33 | |
| 34 | // Note P postfix of a function indicates that it should only be called by the |
| 35 | // processing thread. |
| 36 | |
| 37 | #ifndef TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_ |
| 38 | #define TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_ |
| 39 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 40 | #include "webrtc/base/basictypes.h" |
| 41 | #include "webrtc/base/criticalsection.h" |
| 42 | #include "webrtc/base/messagehandler.h" |
deadbeef | ee8c6d3 | 2015-08-13 14:27:18 -0700 | [diff] [blame] | 43 | #include "webrtc/base/scoped_ptr.h" |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 44 | #include "webrtc/base/scoped_ref_ptr.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 45 | #include "webrtc/common_types.h" |
| 46 | #include "webrtc/modules/audio_device/include/audio_device.h" |
| 47 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 48 | namespace rtc { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 49 | class Thread; |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 50 | } // namespace rtc |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 51 | |
| 52 | class FakeAudioCaptureModule |
| 53 | : public webrtc::AudioDeviceModule, |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 54 | public rtc::MessageHandler { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 55 | public: |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 56 | typedef uint16_t Sample; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 57 | |
| 58 | // The value for the following constants have been derived by running VoE |
| 59 | // using a real ADM. The constants correspond to 10ms of mono audio at 44kHz. |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 60 | static const size_t kNumberSamples = 440; |
| 61 | static const size_t kNumberBytesPerSample = sizeof(Sample); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 62 | |
| 63 | // Creates a FakeAudioCaptureModule or returns NULL on failure. |
deadbeef | ee8c6d3 | 2015-08-13 14:27:18 -0700 | [diff] [blame] | 64 | static rtc::scoped_refptr<FakeAudioCaptureModule> Create(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 65 | |
| 66 | // Returns the number of frames that have been successfully pulled by the |
| 67 | // instance. Note that correctly detecting success can only be done if the |
| 68 | // pulled frame was generated/pushed from a FakeAudioCaptureModule. |
| 69 | int frames_received() const; |
| 70 | |
| 71 | // Following functions are inherited from webrtc::AudioDeviceModule. |
| 72 | // Only functions called by PeerConnection are implemented, the rest do |
| 73 | // nothing and return success. If a function is not expected to be called by |
| 74 | // PeerConnection an assertion is triggered if it is in fact called. |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 75 | int64_t TimeUntilNextProcess() override; |
| 76 | int32_t Process() override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 77 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 78 | int32_t ActiveAudioLayer(AudioLayer* audio_layer) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 79 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 80 | ErrorCode LastError() const override; |
| 81 | int32_t RegisterEventObserver( |
| 82 | webrtc::AudioDeviceObserver* event_callback) override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 83 | |
wu@webrtc.org | 8804a29 | 2013-10-22 23:09:20 +0000 | [diff] [blame] | 84 | // Note: Calling this method from a callback may result in deadlock. |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 85 | int32_t RegisterAudioCallback( |
| 86 | webrtc::AudioTransport* audio_callback) override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 87 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 88 | int32_t Init() override; |
| 89 | int32_t Terminate() override; |
| 90 | bool Initialized() const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 91 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 92 | int16_t PlayoutDevices() override; |
| 93 | int16_t RecordingDevices() override; |
| 94 | int32_t PlayoutDeviceName(uint16_t index, |
| 95 | char name[webrtc::kAdmMaxDeviceNameSize], |
| 96 | char guid[webrtc::kAdmMaxGuidSize]) override; |
| 97 | int32_t RecordingDeviceName(uint16_t index, |
| 98 | char name[webrtc::kAdmMaxDeviceNameSize], |
| 99 | char guid[webrtc::kAdmMaxGuidSize]) override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 100 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 101 | int32_t SetPlayoutDevice(uint16_t index) override; |
| 102 | int32_t SetPlayoutDevice(WindowsDeviceType device) override; |
| 103 | int32_t SetRecordingDevice(uint16_t index) override; |
| 104 | int32_t SetRecordingDevice(WindowsDeviceType device) override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 105 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 106 | int32_t PlayoutIsAvailable(bool* available) override; |
| 107 | int32_t InitPlayout() override; |
| 108 | bool PlayoutIsInitialized() const override; |
| 109 | int32_t RecordingIsAvailable(bool* available) override; |
| 110 | int32_t InitRecording() override; |
| 111 | bool RecordingIsInitialized() const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 112 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 113 | int32_t StartPlayout() override; |
| 114 | int32_t StopPlayout() override; |
| 115 | bool Playing() const override; |
| 116 | int32_t StartRecording() override; |
| 117 | int32_t StopRecording() override; |
| 118 | bool Recording() const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 119 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 120 | int32_t SetAGC(bool enable) override; |
| 121 | bool AGC() const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 122 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 123 | int32_t SetWaveOutVolume(uint16_t volume_left, |
| 124 | uint16_t volume_right) override; |
| 125 | int32_t WaveOutVolume(uint16_t* volume_left, |
| 126 | uint16_t* volume_right) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 127 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 128 | int32_t InitSpeaker() override; |
| 129 | bool SpeakerIsInitialized() const override; |
| 130 | int32_t InitMicrophone() override; |
| 131 | bool MicrophoneIsInitialized() const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 132 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 133 | int32_t SpeakerVolumeIsAvailable(bool* available) override; |
| 134 | int32_t SetSpeakerVolume(uint32_t volume) override; |
| 135 | int32_t SpeakerVolume(uint32_t* volume) const override; |
| 136 | int32_t MaxSpeakerVolume(uint32_t* max_volume) const override; |
| 137 | int32_t MinSpeakerVolume(uint32_t* min_volume) const override; |
| 138 | int32_t SpeakerVolumeStepSize(uint16_t* step_size) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 139 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 140 | int32_t MicrophoneVolumeIsAvailable(bool* available) override; |
| 141 | int32_t SetMicrophoneVolume(uint32_t volume) override; |
| 142 | int32_t MicrophoneVolume(uint32_t* volume) const override; |
| 143 | int32_t MaxMicrophoneVolume(uint32_t* max_volume) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 144 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 145 | int32_t MinMicrophoneVolume(uint32_t* min_volume) const override; |
| 146 | int32_t MicrophoneVolumeStepSize(uint16_t* step_size) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 147 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 148 | int32_t SpeakerMuteIsAvailable(bool* available) override; |
| 149 | int32_t SetSpeakerMute(bool enable) override; |
| 150 | int32_t SpeakerMute(bool* enabled) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 151 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 152 | int32_t MicrophoneMuteIsAvailable(bool* available) override; |
| 153 | int32_t SetMicrophoneMute(bool enable) override; |
| 154 | int32_t MicrophoneMute(bool* enabled) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 155 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 156 | int32_t MicrophoneBoostIsAvailable(bool* available) override; |
| 157 | int32_t SetMicrophoneBoost(bool enable) override; |
| 158 | int32_t MicrophoneBoost(bool* enabled) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 159 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 160 | int32_t StereoPlayoutIsAvailable(bool* available) const override; |
| 161 | int32_t SetStereoPlayout(bool enable) override; |
| 162 | int32_t StereoPlayout(bool* enabled) const override; |
| 163 | int32_t StereoRecordingIsAvailable(bool* available) const override; |
| 164 | int32_t SetStereoRecording(bool enable) override; |
| 165 | int32_t StereoRecording(bool* enabled) const override; |
| 166 | int32_t SetRecordingChannel(const ChannelType channel) override; |
| 167 | int32_t RecordingChannel(ChannelType* channel) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 168 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 169 | int32_t SetPlayoutBuffer(const BufferType type, |
| 170 | uint16_t size_ms = 0) override; |
| 171 | int32_t PlayoutBuffer(BufferType* type, uint16_t* size_ms) const override; |
| 172 | int32_t PlayoutDelay(uint16_t* delay_ms) const override; |
| 173 | int32_t RecordingDelay(uint16_t* delay_ms) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 174 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 175 | int32_t CPULoad(uint16_t* load) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 176 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 177 | int32_t StartRawOutputFileRecording( |
| 178 | const char pcm_file_name_utf8[webrtc::kAdmMaxFileNameSize]) override; |
| 179 | int32_t StopRawOutputFileRecording() override; |
| 180 | int32_t StartRawInputFileRecording( |
| 181 | const char pcm_file_name_utf8[webrtc::kAdmMaxFileNameSize]) override; |
| 182 | int32_t StopRawInputFileRecording() override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 183 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 184 | int32_t SetRecordingSampleRate(const uint32_t samples_per_sec) override; |
| 185 | int32_t RecordingSampleRate(uint32_t* samples_per_sec) const override; |
| 186 | int32_t SetPlayoutSampleRate(const uint32_t samples_per_sec) override; |
| 187 | int32_t PlayoutSampleRate(uint32_t* samples_per_sec) const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 188 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 189 | int32_t ResetAudioDevice() override; |
| 190 | int32_t SetLoudspeakerStatus(bool enable) override; |
| 191 | int32_t GetLoudspeakerStatus(bool* enabled) const override; |
henrika@webrtc.org | a954c07 | 2014-12-09 16:22:09 +0000 | [diff] [blame] | 192 | virtual bool BuiltInAECIsAvailable() const { return false; } |
| 193 | virtual int32_t EnableBuiltInAEC(bool enable) { return -1; } |
henrika | c14f5ff | 2015-09-23 14:08:33 +0200 | [diff] [blame] | 194 | virtual bool BuiltInAGCIsAvailable() const { return false; } |
| 195 | virtual int32_t EnableBuiltInAGC(bool enable) { return -1; } |
| 196 | virtual bool BuiltInNSIsAvailable() const { return false; } |
| 197 | virtual int32_t EnableBuiltInNS(bool enable) { return -1; } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 198 | // End of functions inherited from webrtc::AudioDeviceModule. |
| 199 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 200 | // The following function is inherited from rtc::MessageHandler. |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 201 | void OnMessage(rtc::Message* msg) override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 202 | |
| 203 | protected: |
| 204 | // The constructor is protected because the class needs to be created as a |
| 205 | // reference counted object (for memory managment reasons). It could be |
| 206 | // exposed in which case the burden of proper instantiation would be put on |
| 207 | // the creator of a FakeAudioCaptureModule instance. To create an instance of |
| 208 | // this class use the Create(..) API. |
deadbeef | ee8c6d3 | 2015-08-13 14:27:18 -0700 | [diff] [blame] | 209 | explicit FakeAudioCaptureModule(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 210 | // The destructor is protected because it is reference counted and should not |
| 211 | // be deleted directly. |
| 212 | virtual ~FakeAudioCaptureModule(); |
| 213 | |
| 214 | private: |
| 215 | // Initializes the state of the FakeAudioCaptureModule. This API is called on |
| 216 | // creation by the Create() API. |
| 217 | bool Initialize(); |
| 218 | // SetBuffer() sets all samples in send_buffer_ to |value|. |
| 219 | void SetSendBuffer(int value); |
| 220 | // Resets rec_buffer_. I.e., sets all rec_buffer_ samples to 0. |
| 221 | void ResetRecBuffer(); |
| 222 | // Returns true if rec_buffer_ contains one or more sample greater than or |
| 223 | // equal to |value|. |
| 224 | bool CheckRecBuffer(int value); |
| 225 | |
wu@webrtc.org | 8804a29 | 2013-10-22 23:09:20 +0000 | [diff] [blame] | 226 | // Returns true/false depending on if recording or playback has been |
| 227 | // enabled/started. |
| 228 | bool ShouldStartProcessing(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 229 | |
wu@webrtc.org | 8804a29 | 2013-10-22 23:09:20 +0000 | [diff] [blame] | 230 | // Starts or stops the pushing and pulling of audio frames. |
| 231 | void UpdateProcessing(bool start); |
| 232 | |
| 233 | // Starts the periodic calling of ProcessFrame() in a thread safe way. |
| 234 | void StartProcessP(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 235 | // Periodcally called function that ensures that frames are pulled and pushed |
| 236 | // periodically if enabled/started. |
| 237 | void ProcessFrameP(); |
| 238 | // Pulls frames from the registered webrtc::AudioTransport. |
| 239 | void ReceiveFrameP(); |
| 240 | // Pushes frames to the registered webrtc::AudioTransport. |
| 241 | void SendFrameP(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 242 | |
| 243 | // The time in milliseconds when Process() was last called or 0 if no call |
| 244 | // has been made. |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 245 | uint32_t last_process_time_ms_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 246 | |
| 247 | // Callback for playout and recording. |
| 248 | webrtc::AudioTransport* audio_callback_; |
| 249 | |
| 250 | bool recording_; // True when audio is being pushed from the instance. |
| 251 | bool playing_; // True when audio is being pulled by the instance. |
| 252 | |
| 253 | bool play_is_initialized_; // True when the instance is ready to pull audio. |
| 254 | bool rec_is_initialized_; // True when the instance is ready to push audio. |
| 255 | |
| 256 | // Input to and output from RecordedDataIsAvailable(..) makes it possible to |
| 257 | // modify the current mic level. The implementation does not care about the |
| 258 | // mic level so it just feeds back what it receives. |
| 259 | uint32_t current_mic_level_; |
| 260 | |
| 261 | // next_frame_time_ is updated in a non-drifting manner to indicate the next |
| 262 | // wall clock time the next frame should be generated and received. started_ |
| 263 | // ensures that next_frame_time_ can be initialized properly on first call. |
| 264 | bool started_; |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 265 | uint32_t next_frame_time_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 266 | |
deadbeef | ee8c6d3 | 2015-08-13 14:27:18 -0700 | [diff] [blame] | 267 | rtc::scoped_ptr<rtc::Thread> process_thread_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 268 | |
| 269 | // Buffer for storing samples received from the webrtc::AudioTransport. |
| 270 | char rec_buffer_[kNumberSamples * kNumberBytesPerSample]; |
| 271 | // Buffer for samples to send to the webrtc::AudioTransport. |
| 272 | char send_buffer_[kNumberSamples * kNumberBytesPerSample]; |
| 273 | |
| 274 | // Counter of frames received that have samples of high enough amplitude to |
| 275 | // indicate that the frames are not faked somewhere in the audio pipeline |
| 276 | // (e.g. by a jitter buffer). |
| 277 | int frames_received_; |
wu@webrtc.org | 8804a29 | 2013-10-22 23:09:20 +0000 | [diff] [blame] | 278 | |
| 279 | // Protects variables that are accessed from process_thread_ and |
| 280 | // the main thread. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 281 | mutable rtc::CriticalSection crit_; |
wu@webrtc.org | 8804a29 | 2013-10-22 23:09:20 +0000 | [diff] [blame] | 282 | // Protects |audio_callback_| that is accessed from process_thread_ and |
| 283 | // the main thread. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 284 | rtc::CriticalSection crit_callback_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 285 | }; |
| 286 | |
| 287 | #endif // TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_ |