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