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 rtc { |
| 24 class PlatformThread; |
| 25 } // namespace rtc |
| 26 |
23 namespace webrtc { | 27 namespace webrtc { |
24 class EventWrapper; | 28 class EventWrapper; |
25 class PlatformThread; | |
26 | 29 |
27 // This is a fake audio device which plays audio from a file as its microphone | 30 // This is a fake audio device which plays audio from a file as its microphone |
28 // and plays out into a file. | 31 // and plays out into a file. |
29 class FileAudioDevice : public AudioDeviceGeneric { | 32 class FileAudioDevice : public AudioDeviceGeneric { |
30 public: | 33 public: |
31 // Constructs a file audio device with |id|. It will read audio from | 34 // Constructs a file audio device with |id|. It will read audio from |
32 // |inputFilename| and record output audio to |outputFilename|. | 35 // |inputFilename| and record output audio to |outputFilename|. |
33 // | 36 // |
34 // The input file should be a readable 48k stereo raw file, and the output | 37 // 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 | 38 // 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. | 174 int8_t* _recordingBuffer; // In bytes. |
172 int8_t* _playoutBuffer; // In bytes. | 175 int8_t* _playoutBuffer; // In bytes. |
173 uint32_t _recordingFramesLeft; | 176 uint32_t _recordingFramesLeft; |
174 uint32_t _playoutFramesLeft; | 177 uint32_t _playoutFramesLeft; |
175 CriticalSectionWrapper& _critSect; | 178 CriticalSectionWrapper& _critSect; |
176 | 179 |
177 size_t _recordingBufferSizeIn10MS; | 180 size_t _recordingBufferSizeIn10MS; |
178 size_t _recordingFramesIn10MS; | 181 size_t _recordingFramesIn10MS; |
179 size_t _playoutFramesIn10MS; | 182 size_t _playoutFramesIn10MS; |
180 | 183 |
181 rtc::scoped_ptr<PlatformThread> _ptrThreadRec; | 184 // TODO(pbos): Make plain members instead of pointers and stop resetting them. |
182 rtc::scoped_ptr<PlatformThread> _ptrThreadPlay; | 185 rtc::scoped_ptr<rtc::PlatformThread> _ptrThreadRec; |
| 186 rtc::scoped_ptr<rtc::PlatformThread> _ptrThreadPlay; |
183 | 187 |
184 bool _playing; | 188 bool _playing; |
185 bool _recording; | 189 bool _recording; |
186 uint64_t _lastCallPlayoutMillis; | 190 uint64_t _lastCallPlayoutMillis; |
187 uint64_t _lastCallRecordMillis; | 191 uint64_t _lastCallRecordMillis; |
188 | 192 |
189 FileWrapper& _outputFile; | 193 FileWrapper& _outputFile; |
190 FileWrapper& _inputFile; | 194 FileWrapper& _inputFile; |
191 std::string _outputFilename; | 195 std::string _outputFilename; |
192 std::string _inputFilename; | 196 std::string _inputFilename; |
193 | 197 |
194 Clock* _clock; | 198 Clock* _clock; |
195 }; | 199 }; |
196 | 200 |
197 } // namespace webrtc | 201 } // namespace webrtc |
198 | 202 |
199 #endif // WEBRTC_AUDIO_DEVICE_FILE_AUDIO_DEVICE_H | 203 #endif // WEBRTC_AUDIO_DEVICE_FILE_AUDIO_DEVICE_H |
OLD | NEW |