Move request_stage.* to extensions/browser/api/declarative_webrequest.
[chromium-blink-merge.git] / remoting / host / audio_capturer_win.h
blob1a7ddadb6f89c7bc8ee75fc9e11a0832afa7121e
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_AUDIO_CAPTURER_WIN_H_
6 #define REMOTING_HOST_AUDIO_CAPTURER_WIN_H_
8 #include <audioclient.h>
9 #include <mmdeviceapi.h>
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/threading/thread_checker.h"
14 #include "base/timer/timer.h"
15 #include "base/win/scoped_co_mem.h"
16 #include "base/win/scoped_comptr.h"
17 #include "remoting/host/audio_capturer.h"
18 #include "remoting/host/audio_silence_detector.h"
19 #include "remoting/proto/audio.pb.h"
21 namespace remoting {
23 class AudioCapturerWin : public AudioCapturer {
24 public:
25 AudioCapturerWin();
26 virtual ~AudioCapturerWin();
28 // AudioCapturer interface.
29 virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE;
30 virtual void Stop() OVERRIDE;
31 virtual bool IsStarted() OVERRIDE;
33 private:
34 // Receives all packets from the audio capture endpoint buffer and pushes them
35 // to the network.
36 void DoCapture();
38 PacketCapturedCallback callback_;
40 AudioPacket::SamplingRate sampling_rate_;
42 scoped_ptr<base::RepeatingTimer<AudioCapturerWin> > capture_timer_;
43 base::TimeDelta audio_device_period_;
45 AudioSilenceDetector silence_detector_;
47 base::win::ScopedCoMem<WAVEFORMATEX> wave_format_ex_;
48 base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_;
49 base::win::ScopedComPtr<IAudioClient> audio_client_;
50 base::win::ScopedComPtr<IMMDevice> mm_device_;
52 HRESULT last_capture_error_;
54 base::ThreadChecker thread_checker_;
56 DISALLOW_COPY_AND_ASSIGN(AudioCapturerWin);
59 } // namespace remoting
61 #endif // REMOTING_HOST_AUDIO_CAPTURER_WIN_H_