Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: remoting/host/audio_capturer_win.cc

Issue 10823440: Silence detection test for the Windows audio capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/host/audio_capturer_win.cc
diff --git a/remoting/host/audio_capturer_win.cc b/remoting/host/audio_capturer_win.cc
index 4dfc174da4aedc96ecf3e875ce526d79c75763bf..ae217f91d0610f991240b542fee837158b564115 100644
--- a/remoting/host/audio_capturer_win.cc
+++ b/remoting/host/audio_capturer_win.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "remoting/host/audio_capturer_win.h"
+
#include <windows.h>
#include <audioclient.h>
Sergey Ulanov 2012/08/21 21:34:39 Don't need to include files that are already inclu
kxing 2012/08/21 21:55:53 Done.
#include <avrt.h>
@@ -46,41 +48,6 @@ const int kMaxExpectedTimerLag = 30;
namespace remoting {
-class AudioCapturerWin : public AudioCapturer {
- public:
- AudioCapturerWin();
- virtual ~AudioCapturerWin();
-
- // AudioCapturer interface.
- virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE;
- virtual void Stop() OVERRIDE;
- virtual bool IsRunning() OVERRIDE;
-
- private:
- // Receives all packets from the audio capture endpoint buffer and pushes them
- // to the network.
- void DoCapture();
-
- static bool IsPacketOfSilence(const int16* samples, int number_of_samples);
-
- PacketCapturedCallback callback_;
-
- AudioPacket::SamplingRate sampling_rate_;
-
- scoped_ptr<base::RepeatingTimer<AudioCapturerWin> > capture_timer_;
- base::TimeDelta audio_device_period_;
-
- base::win::ScopedCoMem<WAVEFORMATEX> wave_format_ex_;
- base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_;
- base::win::ScopedComPtr<IAudioClient> audio_client_;
- base::win::ScopedComPtr<IMMDevice> mm_device_;
- scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
-
- base::ThreadChecker thread_checker_;
-
- DISALLOW_COPY_AND_ASSIGN(AudioCapturerWin);
-};
-
AudioCapturerWin::AudioCapturerWin()
: sampling_rate_(AudioPacket::SAMPLING_RATE_INVALID) {
thread_checker_.DetachFromThread();
@@ -313,6 +280,7 @@ void AudioCapturerWin::DoCapture() {
// Detects whether there is audio playing in a packet of samples.
// Windows can give nonzero samples, even when there is no audio playing, so
// extremely low amplitude samples are counted as silence.
+// static
bool AudioCapturerWin::IsPacketOfSilence(
const int16* samples, int number_of_samples) {
for (int i = 0; i < number_of_samples; i++) {

Powered by Google App Engine
This is Rietveld 408576698