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

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

Issue 10823323: Add support for multiplexed channels in remoting::protocol::Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ~ 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PROTOCOL_AUDIO_WRITER_H_ 5 #ifndef REMOTING_PROTOCOL_AUDIO_WRITER_H_
6 #define REMOTING_PROTOCOL_AUDIO_WRITER_H_ 6 #define REMOTING_PROTOCOL_AUDIO_WRITER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "remoting/protocol/audio_stub.h" 14 #include "remoting/protocol/audio_stub.h"
15 #include "remoting/protocol/buffered_socket_writer.h" 15 #include "remoting/protocol/buffered_socket_writer.h"
16 #include "remoting/protocol/channel_dispatcher_base.h"
16 17
17 namespace net { 18 namespace net {
18 class StreamSocket; 19 class StreamSocket;
19 } // namespace net 20 } // namespace net
20 21
21 namespace remoting { 22 namespace remoting {
22 namespace protocol { 23 namespace protocol {
23 24
24 class Session; 25 class Session;
25 class SessionConfig; 26 class SessionConfig;
26 27
27 class AudioWriter : public AudioStub { 28 class AudioWriter : public ChannelDispatcherBase,
29 public AudioStub {
28 public: 30 public:
29 virtual ~AudioWriter(); 31 virtual ~AudioWriter();
30 32
31 // The callback is called when initialization is finished. The 33 // The callback is called when initialization is finished. The
32 // parameter is set to true on success. 34 // parameter is set to true on success.
33 typedef base::Callback<void(bool)> InitializedCallback; 35 typedef base::Callback<void(bool)> InitializedCallback;
Wez 2012/08/18 00:30:36 Remove this.
Sergey Ulanov 2012/08/18 01:53:56 Done.
34 36
35 static scoped_ptr<AudioWriter> Create(const SessionConfig& config); 37 static scoped_ptr<AudioWriter> Create(const SessionConfig& config);
Wez 2012/08/18 00:30:36 nit: Comment to clarify how to configure the Audio
Sergey Ulanov 2012/08/18 01:53:56 Done.
36 38
37 // Initializes the writer.
38 void Init(Session* session, const InitializedCallback& callback);
39
40 // Stops writing. Must be called on the network thread before this
41 // object is destroyed.
42 void Close();
43
44 // Returns true if the channel is connected.
45 bool is_connected();
46
47 // AudioStub interface. 39 // AudioStub interface.
48 virtual void ProcessAudioPacket(scoped_ptr<AudioPacket> packet, 40 virtual void ProcessAudioPacket(scoped_ptr<AudioPacket> packet,
49 const base::Closure& done) OVERRIDE; 41 const base::Closure& done) OVERRIDE;
50 42
43 protected:
44 virtual void OnInitialized() OVERRIDE;
45
51 private: 46 private:
52 AudioWriter(); 47 AudioWriter();
53 48
54 void OnChannelReady(scoped_ptr<net::StreamSocket> socket);
55
56 Session* session_;
57
58 InitializedCallback initialized_callback_;
59
60 // TODO(sergeyu): Remove |channel_| and let |buffered_writer_| own it.
61 scoped_ptr<net::StreamSocket> channel_;
62
63 BufferedSocketWriter buffered_writer_; 49 BufferedSocketWriter buffered_writer_;
64 50
65 DISALLOW_COPY_AND_ASSIGN(AudioWriter); 51 DISALLOW_COPY_AND_ASSIGN(AudioWriter);
66 }; 52 };
67 53
68 } // namespace protocol 54 } // namespace protocol
69 } // namespace remoting 55 } // namespace remoting
70 56
71 #endif // REMOTING_PROTOCOL_AUDIO_WRITER_H_ 57 #endif // REMOTING_PROTOCOL_AUDIO_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698