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

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 comment 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
« no previous file with comments | « remoting/host/audio_capturer_win.h ('k') | remoting/host/audio_capturer_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6479afaad5a453d216cb2614a216d6f822dc3056 100644
--- a/remoting/host/audio_capturer_win.cc
+++ b/remoting/host/audio_capturer_win.cc
@@ -2,26 +2,17 @@
// 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>
#include <avrt.h>
-#include <mmdeviceapi.h>
#include <mmreg.h>
#include <mmsystem.h>
#include <algorithm>
#include <stdlib.h>
-#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop.h"
-#include "base/timer.h"
-#include "base/win/scoped_co_mem.h"
-#include "base/win/scoped_com_initializer.h"
-#include "base/win/scoped_comptr.h"
-#include "remoting/host/audio_capturer.h"
-#include "remoting/proto/audio.pb.h"
namespace {
const int kChannels = 2;
@@ -46,41 +37,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 +269,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++) {
« no previous file with comments | « remoting/host/audio_capturer_win.h ('k') | remoting/host/audio_capturer_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698