OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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_AUDIO_DEVICE_FILE_AUDIO_DEVICE_H | 11 #ifndef WEBRTC_AUDIO_DEVICE_FILE_AUDIO_DEVICE_H |
12 #define WEBRTC_AUDIO_DEVICE_FILE_AUDIO_DEVICE_H | 12 #define WEBRTC_AUDIO_DEVICE_FILE_AUDIO_DEVICE_H |
13 | 13 |
14 #include <stdio.h> | 14 #include <stdio.h> |
15 | 15 |
16 #include <string> | 16 #include <string> |
17 | 17 |
18 #include "webrtc/modules/audio_device/audio_device_generic.h" | 18 #include "webrtc/modules/audio_device/audio_device_generic.h" |
19 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 19 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
20 #include "webrtc/system_wrappers/include/file_wrapper.h" | 20 #include "webrtc/system_wrappers/include/file_wrapper.h" |
21 #include "webrtc/system_wrappers/include/clock.h" | 21 #include "webrtc/system_wrappers/include/clock.h" |
22 | 22 |
23 namespace webrtc { | 23 namespace webrtc { |
24 class EventWrapper; | 24 class EventWrapper; |
25 class ThreadWrapper; | 25 class PlatformThread; |
26 | 26 |
27 // This is a fake audio device which plays audio from a file as its microphone | 27 // This is a fake audio device which plays audio from a file as its microphone |
28 // and plays out into a file. | 28 // and plays out into a file. |
29 class FileAudioDevice : public AudioDeviceGeneric { | 29 class FileAudioDevice : public AudioDeviceGeneric { |
30 public: | 30 public: |
31 // Constructs a file audio device with |id|. It will read audio from | 31 // Constructs a file audio device with |id|. It will read audio from |
32 // |inputFilename| and record output audio to |outputFilename|. | 32 // |inputFilename| and record output audio to |outputFilename|. |
33 // | 33 // |
34 // The input file should be a readable 48k stereo raw file, and the output | 34 // The input file should be a readable 48k stereo raw file, and the output |
35 // file should point to a writable location. The output format will also be | 35 // file should point to a writable location. The output format will also be |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 int8_t* _recordingBuffer; // In bytes. | 171 int8_t* _recordingBuffer; // In bytes. |
172 int8_t* _playoutBuffer; // In bytes. | 172 int8_t* _playoutBuffer; // In bytes. |
173 uint32_t _recordingFramesLeft; | 173 uint32_t _recordingFramesLeft; |
174 uint32_t _playoutFramesLeft; | 174 uint32_t _playoutFramesLeft; |
175 CriticalSectionWrapper& _critSect; | 175 CriticalSectionWrapper& _critSect; |
176 | 176 |
177 size_t _recordingBufferSizeIn10MS; | 177 size_t _recordingBufferSizeIn10MS; |
178 size_t _recordingFramesIn10MS; | 178 size_t _recordingFramesIn10MS; |
179 size_t _playoutFramesIn10MS; | 179 size_t _playoutFramesIn10MS; |
180 | 180 |
181 rtc::scoped_ptr<ThreadWrapper> _ptrThreadRec; | 181 rtc::scoped_ptr<PlatformThread> _ptrThreadRec; |
182 rtc::scoped_ptr<ThreadWrapper> _ptrThreadPlay; | 182 rtc::scoped_ptr<PlatformThread> _ptrThreadPlay; |
183 | 183 |
184 bool _playing; | 184 bool _playing; |
185 bool _recording; | 185 bool _recording; |
186 uint64_t _lastCallPlayoutMillis; | 186 uint64_t _lastCallPlayoutMillis; |
187 uint64_t _lastCallRecordMillis; | 187 uint64_t _lastCallRecordMillis; |
188 | 188 |
189 FileWrapper& _outputFile; | 189 FileWrapper& _outputFile; |
190 FileWrapper& _inputFile; | 190 FileWrapper& _inputFile; |
191 std::string _outputFilename; | 191 std::string _outputFilename; |
192 std::string _inputFilename; | 192 std::string _inputFilename; |
193 | 193 |
194 Clock* _clock; | 194 Clock* _clock; |
195 }; | 195 }; |
196 | 196 |
197 } // namespace webrtc | 197 } // namespace webrtc |
198 | 198 |
199 #endif // WEBRTC_AUDIO_DEVICE_FILE_AUDIO_DEVICE_H | 199 #endif // WEBRTC_AUDIO_DEVICE_FILE_AUDIO_DEVICE_H |
OLD | NEW |