Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_PROTOCOL_AUDIO_READER_H_ | |
| 6 #define REMOTING_PROTOCOL_AUDIO_READER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "remoting/proto/audio.pb.h" | |
| 11 #include "remoting/protocol/audio_stub.h" | |
| 12 #include "remoting/protocol/message_reader.h" | |
| 13 | |
| 14 namespace net { | |
| 15 class StreamSocket; | |
| 16 } // namespace net | |
| 17 | |
| 18 namespace remoting { | |
| 19 namespace protocol { | |
| 20 | |
| 21 class Session; | |
| 22 class SessionConfig; | |
| 23 | |
| 24 class AudioReader { | |
| 25 public: | |
| 26 static AudioReader* Create(const SessionConfig& config); | |
|
Sergey Ulanov
2012/06/15 19:35:23
this should be defined after InitializedCallback.
kxing
2012/06/15 19:46:41
Done.
| |
| 27 | |
| 28 // The callback is called when initialization is finished. The | |
| 29 // parameter is set to true on success. | |
| 30 typedef base::Callback<void(bool)> InitializedCallback; | |
| 31 | |
| 32 AudioReader(AudioPacket::Encoding encoding); | |
|
Sergey Ulanov
2012/06/15 19:35:23
Constructors with a single argument must be marked
kxing
2012/06/15 19:46:41
Done.
| |
| 33 | |
| 34 virtual ~AudioReader(); | |
| 35 | |
| 36 // Initializies the reader. Doesn't take ownership of either |connection| | |
|
Sergey Ulanov
2012/06/15 19:35:23
nit: remove the second sentence: we now use scoped
kxing
2012/06/15 19:46:41
Done.
| |
| 37 // or |audio_stub|. | |
| 38 void Init(Session* session, | |
| 39 AudioStub* audio_stub, | |
|
Sergey Ulanov
2012/06/15 19:35:23
incorrect indentation
kxing
2012/06/15 19:46:41
Done.
| |
| 40 const InitializedCallback& callback); | |
| 41 bool is_connected(); | |
| 42 | |
| 43 private: | |
| 44 void OnChannelReady(scoped_ptr<net::StreamSocket> socket); | |
| 45 void OnNewData(scoped_ptr<AudioPacket> packet, | |
| 46 const base::Closure& done_task); | |
| 47 | |
| 48 Session* session_; | |
| 49 | |
| 50 InitializedCallback initialized_callback_; | |
| 51 | |
| 52 AudioPacket::Encoding encoding_; | |
| 53 | |
| 54 // TODO(sergeyu): Remove |channel_| and let |reader_| own it. | |
| 55 scoped_ptr<net::StreamSocket> channel_; | |
| 56 | |
| 57 ProtobufMessageReader<AudioPacket> reader_; | |
| 58 | |
| 59 // The stub that processes all received packets. | |
| 60 AudioStub* audio_stub_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(AudioReader); | |
| 63 }; | |
| 64 | |
| 65 } // namespace protocol | |
| 66 } // namespace remoting | |
| 67 | |
| 68 #endif // REMOTING_PROTOCOL_AUDIO_READER_H_ | |
| OLD | NEW |