| 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_WRITER_H_ |
| 6 #define REMOTING_PROTOCOL_AUDIO_WRITER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "remoting/protocol/audio_stub.h" |
| 15 #include "remoting/protocol/buffered_socket_writer.h" |
| 16 |
| 17 namespace net { |
| 18 class StreamSocket; |
| 19 } // namespace net |
| 20 |
| 21 namespace remoting { |
| 22 namespace protocol { |
| 23 |
| 24 class Session; |
| 25 class SessionConfig; |
| 26 |
| 27 class AudioWriter : public AudioStub { |
| 28 public: |
| 29 virtual ~AudioWriter(); |
| 30 |
| 31 // The callback is called when initialization is finished. The |
| 32 // parameter is set to true on success. |
| 33 typedef base::Callback<void(bool)> InitializedCallback; |
| 34 |
| 35 static AudioWriter* Create(const SessionConfig& config); |
| 36 |
| 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. |
| 48 virtual void ProcessAudioPacket(scoped_ptr<AudioPacket> packet, |
| 49 const base::Closure& done) OVERRIDE; |
| 50 |
| 51 private: |
| 52 AudioWriter(); |
| 53 |
| 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_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(AudioWriter); |
| 66 }; |
| 67 |
| 68 } // namespace protocol |
| 69 } // namespace remoting |
| 70 |
| 71 #endif // REMOTING_PROTOCOL_AUDIO_WRITER_H_ |
| OLD | NEW |