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

Side by Side Diff: remoting/protocol/audio_reader.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
« no previous file with comments | « no previous file | remoting/protocol/audio_reader.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 (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_READER_H_ 5 #ifndef REMOTING_PROTOCOL_AUDIO_READER_H_
6 #define REMOTING_PROTOCOL_AUDIO_READER_H_ 6 #define REMOTING_PROTOCOL_AUDIO_READER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "remoting/proto/audio.pb.h" 10 #include "remoting/proto/audio.pb.h"
11 #include "remoting/protocol/audio_stub.h" 11 #include "remoting/protocol/audio_stub.h"
12 #include "remoting/protocol/message_reader.h" 12 #include "remoting/protocol/message_reader.h"
13 #include "remoting/protocol/channel_dispatcher_base.h"
13 14
14 namespace net { 15 namespace net {
15 class StreamSocket; 16 class StreamSocket;
16 } // namespace net 17 } // namespace net
17 18
18 namespace remoting { 19 namespace remoting {
19 namespace protocol { 20 namespace protocol {
20 21
21 class Session; 22 class Session;
22 class SessionConfig; 23 class SessionConfig;
23 24
24 class AudioReader { 25 class AudioReader : public ChannelDispatcherBase {
25 public: 26 public:
26 // The callback is called when initialization is finished. The 27 static scoped_ptr<AudioReader> Create(const SessionConfig& config);
27 // parameter is set to true on success.
28 typedef base::Callback<void(bool)> InitializedCallback;
29 28
30 virtual ~AudioReader(); 29 virtual ~AudioReader();
31 30
32 static scoped_ptr<AudioReader> Create(const SessionConfig& config); 31 void set_audio_stub(AudioStub* audio_stub) { audio_stub_ = audio_stub; }
33 32
34 // Initializies the reader. 33 protected:
35 void Init(Session* session, 34 virtual void OnInitialized() OVERRIDE;
36 AudioStub* audio_stub,
37 const InitializedCallback& callback);
38 bool is_connected();
39 35
40 private: 36 private:
41 explicit AudioReader(AudioPacket::Encoding encoding); 37 explicit AudioReader(AudioPacket::Encoding encoding);
42 38
43 void OnChannelReady(scoped_ptr<net::StreamSocket> socket);
44 void OnNewData(scoped_ptr<AudioPacket> packet, 39 void OnNewData(scoped_ptr<AudioPacket> packet,
45 const base::Closure& done_task); 40 const base::Closure& done_task);
46 41
47 Session* session_;
48
49 InitializedCallback initialized_callback_;
50
51 AudioPacket::Encoding encoding_; 42 AudioPacket::Encoding encoding_;
52 43
53 // TODO(sergeyu): Remove |channel_| and let |reader_| own it.
54 scoped_ptr<net::StreamSocket> channel_;
55
56 ProtobufMessageReader<AudioPacket> reader_; 44 ProtobufMessageReader<AudioPacket> reader_;
57 45
58 // The stub that processes all received packets. 46 // The stub that processes all received packets.
59 AudioStub* audio_stub_; 47 AudioStub* audio_stub_;
60 48
61 DISALLOW_COPY_AND_ASSIGN(AudioReader); 49 DISALLOW_COPY_AND_ASSIGN(AudioReader);
62 }; 50 };
63 51
64 } // namespace protocol 52 } // namespace protocol
65 } // namespace remoting 53 } // namespace remoting
66 54
67 #endif // REMOTING_PROTOCOL_AUDIO_READER_H_ 55 #endif // REMOTING_PROTOCOL_AUDIO_READER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/protocol/audio_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698