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

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

Issue 914133003: Fix AudioPump to pause the stream when the network is congested. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@audio_pump
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 unified diff | Download patch
« no previous file with comments | « remoting/codec/audio_encoder_verbatim.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 "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 14 matching lines...) Expand all
25 class AudioPacket; 25 class AudioPacket;
26 26
27 // AudioPump is responsible for fetching audio data from the AudioCapturer 27 // AudioPump is responsible for fetching audio data from the AudioCapturer
28 // and encoding it before passing it to the AudioStub for delivery to the 28 // and encoding it before passing it to the AudioStub for delivery to the
29 // client. Audio is captured and encoded on the audio thread and then passed to 29 // client. Audio is captured and encoded on the audio thread and then passed to
30 // AudioStub on the network thread. 30 // AudioStub on the network thread.
31 class AudioPump { 31 class AudioPump {
32 public: 32 public:
33 // The caller must ensure that the |audio_stub| is not destroyed until the 33 // The caller must ensure that the |audio_stub| is not destroyed until the
34 // pump is destroyed. 34 // pump is destroyed.
35 AudioPump( 35 AudioPump(scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
36 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, 36 scoped_ptr<AudioCapturer> audio_capturer,
37 scoped_ptr<AudioCapturer> audio_capturer, 37 scoped_ptr<AudioEncoder> audio_encoder,
38 scoped_ptr<AudioEncoder> audio_encoder, 38 protocol::AudioStub* audio_stub);
39 protocol::AudioStub* audio_stub);
40 virtual ~AudioPump(); 39 virtual ~AudioPump();
41 40
42 // Pauses or resumes audio on a running session. This leaves the audio 41 // 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 42 // capturer running, and only affects whether or not the captured audio is
44 // encoded and sent on the wire. 43 // encoded and sent on the wire.
45 void Pause(bool pause); 44 void Pause(bool pause);
46 45
47 private: 46 private:
48 class Core; 47 class Core;
49 48
50 // Called on the network thread to send a captured packet to the audio stub. 49 // Called on the network thread to send a captured packet to the audio stub.
51 void SendAudioPacket(scoped_ptr<AudioPacket> packet); 50 void SendAudioPacket(scoped_ptr<AudioPacket> packet, int size);
51
52 // Callback for BufferedSocketWriter.
53 void OnPacketSent(int size);
52 54
53 base::ThreadChecker thread_checker_; 55 base::ThreadChecker thread_checker_;
54 56
55 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; 57 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
56 protocol::AudioStub* audio_stub_; 58 protocol::AudioStub* audio_stub_;
57 59
58 scoped_ptr<Core> core_; 60 scoped_ptr<Core> core_;
59 61
60 base::WeakPtrFactory<AudioPump> weak_factory_; 62 base::WeakPtrFactory<AudioPump> weak_factory_;
61 63
62 DISALLOW_COPY_AND_ASSIGN(AudioPump); 64 DISALLOW_COPY_AND_ASSIGN(AudioPump);
63 }; 65 };
64 66
65 } // namespace remoting 67 } // namespace remoting
66 68
67 #endif // REMOTING_HOST_AUDIO_PUMP_H_ 69 #endif // REMOTING_HOST_AUDIO_PUMP_H_
OLDNEW
« no previous file with comments | « remoting/codec/audio_encoder_verbatim.cc ('k') | remoting/host/audio_pump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698