| OLD | NEW |
| 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" | |
| 9 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 10 #include "remoting/proto/audio.pb.h" | 9 #include "remoting/proto/audio.pb.h" |
| 11 #include "remoting/protocol/audio_stub.h" | 10 #include "remoting/protocol/audio_stub.h" |
| 12 #include "remoting/protocol/message_reader.h" | |
| 13 #include "remoting/protocol/channel_dispatcher_base.h" | 11 #include "remoting/protocol/channel_dispatcher_base.h" |
| 14 | 12 #include "remoting/protocol/protobuf_message_parser.h" |
| 15 namespace net { | |
| 16 class StreamSocket; | |
| 17 } // namespace net | |
| 18 | 13 |
| 19 namespace remoting { | 14 namespace remoting { |
| 20 namespace protocol { | 15 namespace protocol { |
| 21 | 16 |
| 22 class Session; | |
| 23 class SessionConfig; | |
| 24 | |
| 25 class AudioReader : public ChannelDispatcherBase { | 17 class AudioReader : public ChannelDispatcherBase { |
| 26 public: | 18 public: |
| 27 static scoped_ptr<AudioReader> Create(const SessionConfig& config); | 19 explicit AudioReader(AudioStub* audio_stub); |
| 28 | |
| 29 ~AudioReader() override; | 20 ~AudioReader() override; |
| 30 | 21 |
| 31 void set_audio_stub(AudioStub* audio_stub) { audio_stub_ = audio_stub; } | |
| 32 | |
| 33 protected: | |
| 34 void OnInitialized() override; | |
| 35 | |
| 36 private: | 22 private: |
| 37 explicit AudioReader(AudioPacket::Encoding encoding); | 23 ProtobufMessageParser<AudioPacket> parser_; |
| 38 | |
| 39 void OnNewData(scoped_ptr<AudioPacket> packet, | |
| 40 const base::Closure& done_task); | |
| 41 | |
| 42 AudioPacket::Encoding encoding_; | |
| 43 | |
| 44 ProtobufMessageReader<AudioPacket> reader_; | |
| 45 | |
| 46 // The stub that processes all received packets. | |
| 47 AudioStub* audio_stub_; | |
| 48 | 24 |
| 49 DISALLOW_COPY_AND_ASSIGN(AudioReader); | 25 DISALLOW_COPY_AND_ASSIGN(AudioReader); |
| 50 }; | 26 }; |
| 51 | 27 |
| 52 } // namespace protocol | 28 } // namespace protocol |
| 53 } // namespace remoting | 29 } // namespace remoting |
| 54 | 30 |
| 55 #endif // REMOTING_PROTOCOL_AUDIO_READER_H_ | 31 #endif // REMOTING_PROTOCOL_AUDIO_READER_H_ |
| OLD | NEW |