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 // The callback is called when initialization is finished. The | |
| 27 // parameter is set to true on success. | |
| 28 typedef base::Callback<void(bool)> InitializedCallback; | |
| 29 | |
| 30 virtual ~AudioReader(); | |
| 31 | |
| 32 static scoped_ptr<AudioReader> Create(const SessionConfig& config); | |
|
Wez
2012/06/15 20:40:54
Document this Create() function.
| |
| 33 | |
| 34 // Initializies the reader. | |
|
Wez
2012/06/15 20:40:54
typo: Initializes
Wez
2012/06/15 20:40:54
What does it mean to "initialize the reader"? What
| |
| 35 void Init(Session* session, | |
| 36 AudioStub* audio_stub, | |
| 37 const InitializedCallback& callback); | |
| 38 bool is_connected(); | |
|
Wez
2012/06/15 20:40:54
nit: const
| |
| 39 | |
| 40 private: | |
| 41 explicit AudioReader(AudioPacket::Encoding encoding); | |
| 42 | |
| 43 void OnChannelReady(scoped_ptr<net::StreamSocket> socket); | |
| 44 void OnNewData(scoped_ptr<AudioPacket> packet, | |
|
Wez
2012/06/15 20:40:54
nit: OnNewData -> OnAudioData or OnAudioPacket
| |
| 45 const base::Closure& done_task); | |
| 46 | |
| 47 Session* session_; | |
|
Wez
2012/06/15 20:40:54
Why not keep |session_|, |audio_stub_| and |initia
| |
| 48 | |
| 49 InitializedCallback initialized_callback_; | |
| 50 | |
| 51 AudioPacket::Encoding encoding_; | |
| 52 | |
| 53 // TODO(sergeyu): Remove |channel_| and let |reader_| own it. | |
| 54 scoped_ptr<net::StreamSocket> channel_; | |
| 55 | |
| 56 ProtobufMessageReader<AudioPacket> reader_; | |
| 57 | |
| 58 // The stub that processes all received packets. | |
| 59 AudioStub* audio_stub_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(AudioReader); | |
| 62 }; | |
| 63 | |
| 64 } // namespace protocol | |
| 65 } // namespace remoting | |
| 66 | |
| 67 #endif // REMOTING_PROTOCOL_AUDIO_READER_H_ | |
| OLD | NEW |