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

Unified Diff: remoting/host/audio_pump.h

Issue 866863004: Replace AudioScheduler with AudioPump. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mouse_cursor_pipe
Patch Set: Created 5 years, 10 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.cc ('k') | remoting/host/audio_pump.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/audio_pump.h
diff --git a/remoting/host/audio_pump.h b/remoting/host/audio_pump.h
new file mode 100644
index 0000000000000000000000000000000000000000..dcfbd968f753767a57daa12c07aabab6dbcbf20f
--- /dev/null
+++ b/remoting/host/audio_pump.h
@@ -0,0 +1,67 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_AUDIO_PUMP_H_
+#define REMOTING_HOST_AUDIO_PUMP_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+} // namespace base
+
+namespace remoting {
+
+namespace protocol {
+class AudioStub;
+} // namespace protocol
+
+class AudioCapturer;
+class AudioEncoder;
+class AudioPacket;
+
+// AudioPump is responsible for fetching audio data from the AudioCapturer
+// and encoding it before passing it to the AudioStub for delivery to the
+// client. Audio is captured and encoded on the audio thread and then passed to
+// AudioStub on the network thread.
+class AudioPump {
+ public:
+ // The caller must ensure that the |audio_stub| is not destroyed until the
+ // pump is destroyed.
+ AudioPump(
+ scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
+ scoped_ptr<AudioCapturer> audio_capturer,
+ scoped_ptr<AudioEncoder> audio_encoder,
+ protocol::AudioStub* audio_stub);
+ virtual ~AudioPump();
+
+ // Pauses or resumes audio on a running session. This leaves the audio
+ // capturer running, and only affects whether or not the captured audio is
+ // encoded and sent on the wire.
+ void Pause(bool pause);
+
+ private:
+ class Core;
+
+ // Called on the network thread to send a captured packet to the audio stub.
+ void SendAudioPacket(scoped_ptr<AudioPacket> packet);
+
+ base::ThreadChecker thread_checker_;
+
+ scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
+ protocol::AudioStub* audio_stub_;
+
+ scoped_ptr<Core> core_;
+
+ base::WeakPtrFactory<AudioPump> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(AudioPump);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_AUDIO_PUMP_H_
« no previous file with comments | « remoting/host/audio_capturer_win.cc ('k') | remoting/host/audio_pump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698