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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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/host/audio_capturer_win.cc ('k') | remoting/host/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 2015 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_HOST_AUDIO_PUMP_H_
6 #define REMOTING_HOST_AUDIO_PUMP_H_ 6 #define REMOTING_HOST_AUDIO_PUMP_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
13 14
14 namespace base { 15 namespace base {
15 class SingleThreadTaskRunner; 16 class SingleThreadTaskRunner;
16 } // namespace base 17 } // namespace base
17 18
18 namespace remoting { 19 namespace remoting {
19 20
20 namespace protocol { 21 namespace protocol {
21 class AudioStub; 22 class AudioStub;
22 } // namespace protocol 23 } // namespace protocol
23 24
24 class AudioCapturer; 25 class AudioCapturer;
25 class AudioEncoder; 26 class AudioEncoder;
26 class AudioPacket; 27 class AudioPacket;
27 28
28 // AudioPump is responsible for fetching audio data from the AudioCapturer 29 // AudioPump is responsible for fetching audio data from the AudioCapturer
29 // and encoding it before passing it to the AudioStub for delivery to the 30 // and encoding it before passing it to the AudioStub for delivery to the
30 // client. Audio is captured and encoded on the audio thread and then passed to 31 // client. Audio is captured and encoded on the audio thread and then passed to
31 // AudioStub on the network thread. 32 // AudioStub on the network thread.
32 class AudioPump { 33 class AudioPump {
33 public: 34 public:
34 // The caller must ensure that the |audio_stub| is not destroyed until the 35 // The caller must ensure that the |audio_stub| is not destroyed until the
35 // pump is destroyed. 36 // pump is destroyed.
36 AudioPump(scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, 37 AudioPump(scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
37 scoped_ptr<AudioCapturer> audio_capturer, 38 std::unique_ptr<AudioCapturer> audio_capturer,
38 scoped_ptr<AudioEncoder> audio_encoder, 39 std::unique_ptr<AudioEncoder> audio_encoder,
39 protocol::AudioStub* audio_stub); 40 protocol::AudioStub* audio_stub);
40 virtual ~AudioPump(); 41 virtual ~AudioPump();
41 42
42 // Pauses or resumes audio on a running session. This leaves the audio 43 // Pauses or resumes audio on a running session. This leaves the audio
43 // capturer running, and only affects whether or not the captured audio is 44 // capturer running, and only affects whether or not the captured audio is
44 // encoded and sent on the wire. 45 // encoded and sent on the wire.
45 void Pause(bool pause); 46 void Pause(bool pause);
46 47
47 private: 48 private:
48 class Core; 49 class Core;
49 50
50 // Called on the network thread to send a captured packet to the audio stub. 51 // Called on the network thread to send a captured packet to the audio stub.
51 void SendAudioPacket(scoped_ptr<AudioPacket> packet, int size); 52 void SendAudioPacket(std::unique_ptr<AudioPacket> packet, int size);
52 53
53 // Callback for BufferedSocketWriter. 54 // Callback for BufferedSocketWriter.
54 void OnPacketSent(int size); 55 void OnPacketSent(int size);
55 56
56 base::ThreadChecker thread_checker_; 57 base::ThreadChecker thread_checker_;
57 58
58 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; 59 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
59 protocol::AudioStub* audio_stub_; 60 protocol::AudioStub* audio_stub_;
60 61
61 scoped_ptr<Core> core_; 62 std::unique_ptr<Core> core_;
62 63
63 base::WeakPtrFactory<AudioPump> weak_factory_; 64 base::WeakPtrFactory<AudioPump> weak_factory_;
64 65
65 DISALLOW_COPY_AND_ASSIGN(AudioPump); 66 DISALLOW_COPY_AND_ASSIGN(AudioPump);
66 }; 67 };
67 68
68 } // namespace remoting 69 } // namespace remoting
69 70
70 #endif // REMOTING_HOST_AUDIO_PUMP_H_ 71 #endif // REMOTING_HOST_AUDIO_PUMP_H_
OLDNEW
« 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