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 // AudioWriter is a generic interface used by ConnectionToClient to | |
|
Sergey Ulanov
2012/06/14 23:30:17
Update the comment please. It's not a generic inte
kxing
2012/06/14 23:45:15
Done.
| |
| 6 // write into the audio stream. ProtobufAudioWriter implements this | |
| 7 // interface for protobuf audio streams. | |
| 8 | |
| 9 #ifndef REMOTING_PROTOCOL_AUDIO_WRITER_H_ | |
| 10 #define REMOTING_PROTOCOL_AUDIO_WRITER_H_ | |
| 11 | |
| 12 #include <string> | |
| 13 | |
| 14 #include "base/basictypes.h" | |
| 15 #include "base/callback.h" | |
| 16 #include "base/compiler_specific.h" | |
| 17 #include "base/memory/scoped_ptr.h" | |
| 18 #include "remoting/protocol/audio_stub.h" | |
| 19 #include "remoting/protocol/buffered_socket_writer.h" | |
| 20 | |
| 21 namespace net { | |
| 22 class StreamSocket; | |
| 23 } // namespace net | |
| 24 | |
| 25 namespace remoting { | |
| 26 namespace protocol { | |
| 27 | |
| 28 class Session; | |
| 29 class SessionConfig; | |
| 30 | |
| 31 class AudioWriter : public AudioStub { | |
| 32 public: | |
| 33 virtual ~AudioWriter(); | |
| 34 | |
| 35 // The callback is called when initialization is finished. The | |
| 36 // parameter is set to true on success. | |
| 37 typedef base::Callback<void(bool)> InitializedCallback; | |
| 38 | |
| 39 static AudioWriter* Create(const SessionConfig& config); | |
| 40 | |
| 41 // Initializes the writer. | |
| 42 void Init(Session* session, const InitializedCallback& callback); | |
| 43 | |
| 44 // Stops writing. Must be called on the network thread before this | |
| 45 // object is destroyed. | |
| 46 void Close(); | |
| 47 | |
| 48 // Returns true if the channel is connected. | |
| 49 bool is_connected(); | |
| 50 | |
| 51 // AudioStub interface. | |
| 52 virtual void ProcessAudioPacket(scoped_ptr<AudioPacket> packet, | |
| 53 const base::Closure& done) OVERRIDE; | |
| 54 | |
| 55 private: | |
| 56 AudioWriter(); | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(AudioWriter); | |
|
Sergey Ulanov
2012/06/14 23:30:17
This should be at the end of the class definition.
kxing
2012/06/14 23:45:15
Done.
| |
| 59 | |
| 60 void OnChannelReady(scoped_ptr<net::StreamSocket> socket); | |
| 61 | |
| 62 Session* session_; | |
| 63 | |
| 64 InitializedCallback initialized_callback_; | |
| 65 | |
| 66 // TODO(sergeyu): Remove |channel_| and let |buffered_writer_| own it. | |
| 67 scoped_ptr<net::StreamSocket> channel_; | |
| 68 | |
| 69 BufferedSocketWriter buffered_writer_; | |
| 70 }; | |
| 71 | |
| 72 } // namespace protocol | |
| 73 } // namespace remoting | |
| 74 | |
| 75 #endif // REMOTING_PROTOCOL_AUDIO_WRITER_H_ | |
| OLD | NEW |