| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_HOST_AUDIO_CAPTURER_WIN_H_ |
| 6 #define REMOTING_HOST_AUDIO_CAPTURER_WIN_H_ |
| 7 |
| 5 #include <audioclient.h> | 8 #include <audioclient.h> |
| 6 #include <mmdeviceapi.h> | 9 #include <mmdeviceapi.h> |
| 7 | 10 |
| 8 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/timer.h" | 13 #include "base/timer.h" |
| 11 #include "base/win/scoped_co_mem.h" | 14 #include "base/win/scoped_co_mem.h" |
| 12 #include "base/win/scoped_com_initializer.h" | 15 #include "base/win/scoped_com_initializer.h" |
| 13 #include "base/win/scoped_comptr.h" | 16 #include "base/win/scoped_comptr.h" |
| 14 #include "remoting/host/audio_capturer.h" | 17 #include "remoting/host/audio_capturer.h" |
| 15 #include "remoting/proto/audio.pb.h" | 18 #include "remoting/proto/audio.pb.h" |
| 16 | 19 |
| 17 namespace remoting { | 20 namespace remoting { |
| 18 | 21 |
| 19 class AudioCapturerWin : public AudioCapturer { | 22 class AudioCapturerWin : public AudioCapturer { |
| 20 public: | 23 public: |
| 21 AudioCapturerWin(); | 24 AudioCapturerWin(); |
| 22 virtual ~AudioCapturerWin(); | 25 virtual ~AudioCapturerWin(); |
| 23 | 26 |
| 24 // AudioCapturer interface. | 27 // AudioCapturer interface. |
| 25 virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE; | 28 virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE; |
| 26 virtual void Stop() OVERRIDE; | 29 virtual void Stop() OVERRIDE; |
| 27 virtual bool IsRunning() OVERRIDE; | 30 virtual bool IsStarted() OVERRIDE; |
| 28 | 31 |
| 29 static bool IsPacketOfSilence(const int16* samples, int number_of_samples); | 32 static bool IsPacketOfSilence(const int16* samples, int number_of_samples); |
| 30 | 33 |
| 31 private: | 34 private: |
| 32 // Receives all packets from the audio capture endpoint buffer and pushes them | 35 // Receives all packets from the audio capture endpoint buffer and pushes them |
| 33 // to the network. | 36 // to the network. |
| 34 void DoCapture(); | 37 void DoCapture(); |
| 35 | 38 |
| 36 PacketCapturedCallback callback_; | 39 PacketCapturedCallback callback_; |
| 37 | 40 |
| 38 AudioPacket::SamplingRate sampling_rate_; | 41 AudioPacket::SamplingRate sampling_rate_; |
| 39 | 42 |
| 40 scoped_ptr<base::RepeatingTimer<AudioCapturerWin> > capture_timer_; | 43 scoped_ptr<base::RepeatingTimer<AudioCapturerWin> > capture_timer_; |
| 41 base::TimeDelta audio_device_period_; | 44 base::TimeDelta audio_device_period_; |
| 42 | 45 |
| 43 base::win::ScopedCoMem<WAVEFORMATEX> wave_format_ex_; | 46 base::win::ScopedCoMem<WAVEFORMATEX> wave_format_ex_; |
| 44 base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_; | 47 base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_; |
| 45 base::win::ScopedComPtr<IAudioClient> audio_client_; | 48 base::win::ScopedComPtr<IAudioClient> audio_client_; |
| 46 base::win::ScopedComPtr<IMMDevice> mm_device_; | 49 base::win::ScopedComPtr<IMMDevice> mm_device_; |
| 47 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; | 50 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; |
| 48 | 51 |
| 49 base::ThreadChecker thread_checker_; | 52 base::ThreadChecker thread_checker_; |
| 50 | 53 |
| 51 DISALLOW_COPY_AND_ASSIGN(AudioCapturerWin); | 54 DISALLOW_COPY_AND_ASSIGN(AudioCapturerWin); |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 } // namespace remoting | 57 } // namespace remoting |
| 58 |
| 59 #endif // REMOTING_HOST_AUDIO_CAPTURER_WIN_H_ |
| OLD | NEW |