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

Side by Side Diff: remoting/protocol/audio_pump.h

Issue 2254673002: Remove dependency on AudioStub in ConnectionToClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/BUILD.gn ('k') | remoting/protocol/audio_pump.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_PUMP_H_ 5 #ifndef REMOTING_PROTOCOL_AUDIO_PUMP_H_
6 #define REMOTING_HOST_AUDIO_PUMP_H_ 6 #define REMOTING_PROTOCOL_AUDIO_PUMP_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "remoting/protocol/audio_stream.h"
14 15
15 namespace base { 16 namespace base {
16 class SingleThreadTaskRunner; 17 class SingleThreadTaskRunner;
17 } // namespace base 18 } // namespace base
18 19
19 namespace remoting { 20 namespace remoting {
20 21
21 namespace protocol {
22 class AudioStub;
23 } // namespace protocol
24
25 class AudioCapturer;
26 class AudioEncoder; 22 class AudioEncoder;
27 class AudioPacket; 23 class AudioPacket;
28 24
25 namespace protocol {
26
27 class AudioStub;
28 class AudioSource;
29
29 // AudioPump is responsible for fetching audio data from the AudioCapturer 30 // AudioPump is responsible for fetching audio data from the AudioCapturer
30 // and encoding it before passing it to the AudioStub for delivery to the 31 // and encoding it before passing it to the AudioStub for delivery to the
31 // client. Audio is captured and encoded on the audio thread and then passed to 32 // client. Audio is captured and encoded on the audio thread and then passed to
32 // AudioStub on the network thread. 33 // AudioStub on the network thread.
33 class AudioPump { 34 class AudioPump : public AudioStream {
34 public: 35 public:
35 // The caller must ensure that the |audio_stub| is not destroyed until the 36 // The caller must ensure that the |audio_stub| is not destroyed until the
36 // pump is destroyed. 37 // pump is destroyed.
37 AudioPump(scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, 38 AudioPump(scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
38 std::unique_ptr<AudioCapturer> audio_capturer, 39 std::unique_ptr<AudioSource> audio_source,
39 std::unique_ptr<AudioEncoder> audio_encoder, 40 std::unique_ptr<AudioEncoder> audio_encoder,
40 protocol::AudioStub* audio_stub); 41 AudioStub* audio_stub);
41 virtual ~AudioPump(); 42 ~AudioPump() override;
42 43
43 // Pauses or resumes audio on a running session. This leaves the audio 44 // AudioStream interface.
44 // capturer running, and only affects whether or not the captured audio is 45 void Pause(bool pause) override;
45 // encoded and sent on the wire.
46 void Pause(bool pause);
47 46
48 private: 47 private:
49 class Core; 48 class Core;
50 49
51 // Called on the network thread to send a captured packet to the audio stub. 50 // Called on the network thread to send a captured packet to the audio stub.
52 void SendAudioPacket(std::unique_ptr<AudioPacket> packet, int size); 51 void SendAudioPacket(std::unique_ptr<AudioPacket> packet, int size);
53 52
54 // Callback for BufferedSocketWriter. 53 // Callback for BufferedSocketWriter.
55 void OnPacketSent(int size); 54 void OnPacketSent(int size);
56 55
57 base::ThreadChecker thread_checker_; 56 base::ThreadChecker thread_checker_;
58 57
59 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; 58 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
60 protocol::AudioStub* audio_stub_; 59 AudioStub* audio_stub_;
61 60
62 std::unique_ptr<Core> core_; 61 std::unique_ptr<Core> core_;
63 62
64 base::WeakPtrFactory<AudioPump> weak_factory_; 63 base::WeakPtrFactory<AudioPump> weak_factory_;
65 64
66 DISALLOW_COPY_AND_ASSIGN(AudioPump); 65 DISALLOW_COPY_AND_ASSIGN(AudioPump);
67 }; 66 };
68 67
68 } // namespace protocol
69 } // namespace remoting 69 } // namespace remoting
70 70
71 #endif // REMOTING_HOST_AUDIO_PUMP_H_ 71 #endif // REMOTING_PROTOCOL_AUDIO_PUMP_H_
OLDNEW
« no previous file with comments | « remoting/protocol/BUILD.gn ('k') | remoting/protocol/audio_pump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698