Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #include <windows.h> | |
| 6 #include <audioclient.h> | |
| 7 #include <avrt.h> | |
| 8 #include <mmdeviceapi.h> | |
| 9 #include <mmreg.h> | |
| 10 #include <mmsystem.h> | |
|
Sergey Ulanov
2012/08/21 21:34:39
Do we need all of these includes in the header?
kxing
2012/08/21 21:55:53
Done.
| |
| 11 | |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/message_loop.h" | |
|
Sergey Ulanov
2012/08/21 21:34:39
Don't need this include here.
kxing
2012/08/21 21:55:53
Done.
| |
| 15 #include "base/timer.h" | |
| 16 #include "base/win/scoped_co_mem.h" | |
| 17 #include "base/win/scoped_com_initializer.h" | |
| 18 #include "base/win/scoped_comptr.h" | |
| 19 #include "remoting/host/audio_capturer.h" | |
| 20 #include "remoting/proto/audio.pb.h" | |
| 21 | |
| 22 namespace remoting { | |
| 23 | |
| 24 class AudioCapturerWin : public AudioCapturer { | |
| 25 public: | |
| 26 AudioCapturerWin(); | |
| 27 virtual ~AudioCapturerWin(); | |
| 28 | |
| 29 // AudioCapturer interface. | |
| 30 virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE; | |
| 31 virtual void Stop() OVERRIDE; | |
| 32 virtual bool IsRunning() OVERRIDE; | |
| 33 | |
| 34 static bool IsPacketOfSilence(const int16* samples, int number_of_samples); | |
| 35 | |
| 36 private: | |
| 37 // Receives all packets from the audio capture endpoint buffer and pushes them | |
| 38 // to the network. | |
| 39 void DoCapture(); | |
| 40 | |
| 41 PacketCapturedCallback callback_; | |
| 42 | |
| 43 AudioPacket::SamplingRate sampling_rate_; | |
| 44 | |
| 45 scoped_ptr<base::RepeatingTimer<AudioCapturerWin> > capture_timer_; | |
| 46 base::TimeDelta audio_device_period_; | |
| 47 | |
| 48 base::win::ScopedCoMem<WAVEFORMATEX> wave_format_ex_; | |
| 49 base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_; | |
| 50 base::win::ScopedComPtr<IAudioClient> audio_client_; | |
| 51 base::win::ScopedComPtr<IMMDevice> mm_device_; | |
| 52 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; | |
| 53 | |
| 54 base::ThreadChecker thread_checker_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(AudioCapturerWin); | |
| 57 }; | |
| 58 | |
| 59 } // namespace remoting | |
| OLD | NEW |