Index: webrtc/test/fake_audio_device.h |
diff --git a/webrtc/test/fake_audio_device.h b/webrtc/test/fake_audio_device.h |
index 77a74bac8f6d1bc962cf8b8aceea9313f9c50bec..af7a9cb33008874ab8e027a20c382920028e6123 100644 |
--- a/webrtc/test/fake_audio_device.h |
+++ b/webrtc/test/fake_audio_device.h |
@@ -23,17 +23,25 @@ namespace webrtc { |
class Clock; |
class EventTimerWrapper; |
-class FileWrapper; |
-class ModuleFileUtility; |
namespace test { |
class FakeAudioDevice : public FakeAudioDeviceModule { |
public: |
- FakeAudioDevice(Clock* clock, const std::string& filename, float speed); |
peah-webrtc
2017/01/25 10:45:28
It seems to me very strange that the sample rate i
|
+ // Creates a new FakeAudioDevice. |speed| controls how much faster or slower |
+ // time elapse compared to the system clock. It can be used to simulate |
+ // clock drift. 1.0 means that the system clock will be used. |
+ FakeAudioDevice(Clock* clock, float speed); |
+ ~FakeAudioDevice() override; |
- virtual ~FakeAudioDevice(); |
+ int32_t StartPlayout() override; |
+ int32_t StopPlayout() override; |
+ // Generates a sine tone with |frequency_in_hz| and |peak_to_peak|. |
+ void StartRecordingSine(int frequency_in_hz, uint16_t peak_to_peak); |
+ int32_t StopRecording() override; |
+ |
+ private: |
int32_t Init() override; |
int32_t RegisterAudioCallback(AudioTransport* callback) override; |
@@ -41,29 +49,27 @@ class FakeAudioDevice : public FakeAudioDeviceModule { |
int32_t PlayoutDelay(uint16_t* delay_ms) const override; |
bool Recording() const override; |
- void Start(); |
- void Stop(); |
- |
- private: |
static bool Run(void* obj); |
- void CaptureAudio(); |
+ void ProcessAudio(); |
static const uint32_t kFrequencyHz = 16000; |
static const size_t kBufferSizeBytes = 2 * kFrequencyHz; |
- AudioTransport* audio_callback_; |
- bool capturing_; |
- int8_t captured_audio_[kBufferSizeBytes]; |
+ rtc::CriticalSection lock_; |
+ AudioTransport* audio_callback_ GUARDED_BY(lock_); |
+ bool rendering_ GUARDED_BY(lock_); |
+ |
+ class SinusCapturer; |
+ std::unique_ptr<SinusCapturer> capturer_ GUARDED_BY(lock_); |
+ |
+ // Used for playout. |
int8_t playout_buffer_[kBufferSizeBytes]; |
const float speed_; |
int64_t last_playout_ms_; |
DriftingClock clock_; |
std::unique_ptr<EventTimerWrapper> tick_; |
- rtc::CriticalSection lock_; |
rtc::PlatformThread thread_; |
- std::unique_ptr<ModuleFileUtility> file_utility_; |
- std::unique_ptr<FileWrapper> input_stream_; |
}; |
} // namespace test |
} // namespace webrtc |