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

Side by Side Diff: webrtc/modules/audio_device/dummy/file_audio_device.h

Issue 2459873002: Revert of Replace FileWrapper with File (in audio_device) (Closed)
Patch Set: Created 4 years, 1 month 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 (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_MODULES_AUDIO_DEVICE_DUMMY_FILE_AUDIO_DEVICE_H_ 11 #ifndef WEBRTC_AUDIO_DEVICE_FILE_AUDIO_DEVICE_H
12 #define WEBRTC_MODULES_AUDIO_DEVICE_DUMMY_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 <memory> 16 #include <memory>
17 #include <string> 17 #include <string>
18 18
19 #include "webrtc/base/file.h"
20 #include "webrtc/modules/audio_device/audio_device_generic.h" 19 #include "webrtc/modules/audio_device/audio_device_generic.h"
21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 20 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
21 #include "webrtc/system_wrappers/include/file_wrapper.h"
22 #include "webrtc/system_wrappers/include/clock.h" 22 #include "webrtc/system_wrappers/include/clock.h"
23 23
24 namespace rtc { 24 namespace rtc {
25 class PlatformThread; 25 class PlatformThread;
26 } // namespace rtc 26 } // namespace rtc
27 27
28 namespace webrtc { 28 namespace webrtc {
29 class EventWrapper; 29 class EventWrapper;
30 30
31 // This is a fake audio device which plays audio from a file as its microphone 31 // This is a fake audio device which plays audio from a file as its microphone
32 // and plays out into a file. 32 // and plays out into a file.
33 class FileAudioDevice : public AudioDeviceGeneric { 33 class FileAudioDevice : public AudioDeviceGeneric {
34 public: 34 public:
35 // Constructs a file audio device with |id|. It will read audio from 35 // Constructs a file audio device with |id|. It will read audio from
36 // |inputFilename| and record output audio to |outputFilename|. 36 // |inputFilename| and record output audio to |outputFilename|.
37 // 37 //
38 // The input file should be a readable 48k stereo raw file, and the output 38 // The input file should be a readable 48k stereo raw file, and the output
39 // file should point to a writable location. The output format will also be 39 // file should point to a writable location. The output format will also be
40 // 48k stereo raw audio. 40 // 48k stereo raw audio.
41 FileAudioDevice(const int32_t id, 41 FileAudioDevice(const int32_t id,
42 const char* inputFilename, 42 const char* inputFilename,
43 const char* outputFilename); 43 const char* outputFilename);
44 virtual ~FileAudioDevice();
44 45
45 // Retrieve the currently utilized audio layer 46 // Retrieve the currently utilized audio layer
46 int32_t ActiveAudioLayer( 47 int32_t ActiveAudioLayer(
47 AudioDeviceModule::AudioLayer& audioLayer) const override; 48 AudioDeviceModule::AudioLayer& audioLayer) const override;
48 49
49 // Main initializaton and termination 50 // Main initializaton and termination
50 InitStatus Init() override; 51 InitStatus Init() override;
51 int32_t Terminate() override; 52 int32_t Terminate() override;
52 bool Initialized() const override; 53 bool Initialized() const override;
53 54
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 184
184 // TODO(pbos): Make plain members instead of pointers and stop resetting them. 185 // TODO(pbos): Make plain members instead of pointers and stop resetting them.
185 std::unique_ptr<rtc::PlatformThread> _ptrThreadRec; 186 std::unique_ptr<rtc::PlatformThread> _ptrThreadRec;
186 std::unique_ptr<rtc::PlatformThread> _ptrThreadPlay; 187 std::unique_ptr<rtc::PlatformThread> _ptrThreadPlay;
187 188
188 bool _playing; 189 bool _playing;
189 bool _recording; 190 bool _recording;
190 uint64_t _lastCallPlayoutMillis; 191 uint64_t _lastCallPlayoutMillis;
191 uint64_t _lastCallRecordMillis; 192 uint64_t _lastCallRecordMillis;
192 193
193 rtc::File _outputFile; 194 FileWrapper& _outputFile;
194 rtc::File _inputFile; 195 FileWrapper& _inputFile;
195 std::string _outputFilename; 196 std::string _outputFilename;
196 std::string _inputFilename; 197 std::string _inputFilename;
197 198
198 Clock* _clock; 199 Clock* _clock;
199 }; 200 };
200 201
201 } // namespace webrtc 202 } // namespace webrtc
202 203
203 #endif // WEBRTC_MODULES_AUDIO_DEVICE_DUMMY_FILE_AUDIO_DEVICE_H_ 204 #endif // WEBRTC_AUDIO_DEVICE_FILE_AUDIO_DEVICE_H
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/audio_device_buffer.h ('k') | webrtc/modules/audio_device/dummy/file_audio_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698