Chromium Code Reviews| 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 // VideoReader is a generic interface used by ConnectionToHost to read | |
| 6 // video stream. ProtobufVideoReader implements this interface for | |
| 7 // protobuf video stream. | |
| 8 | |
| 9 #ifndef REMOTING_PROTOCOL_VIDEO_READER_H_ | 5 #ifndef REMOTING_PROTOCOL_VIDEO_READER_H_ |
| 10 #define REMOTING_PROTOCOL_VIDEO_READER_H_ | 6 #define REMOTING_PROTOCOL_VIDEO_READER_H_ |
| 11 | 7 |
| 12 #include "base/callback.h" | 8 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 9 #include "remoting/proto/video.pb.h" |
| 14 #include "remoting/protocol/video_stub.h" | 10 #include "remoting/protocol/channel_dispatcher_base.h" |
| 11 #include "remoting/protocol/message_reader.h" | |
| 12 | |
| 13 namespace net { | |
| 14 class StreamSocket; | |
| 15 } // namespace net | |
| 15 | 16 |
| 16 namespace remoting { | 17 namespace remoting { |
| 17 namespace protocol { | 18 namespace protocol { |
| 18 | 19 |
| 20 class StreamChannelFactory; | |
| 19 class Session; | 21 class Session; |
| 20 class SessionConfig; | 22 class VideoStub; |
| 21 | 23 |
| 22 class VideoReader { | 24 class VideoReader : public ChannelDispatcherBase { |
| 23 public: | 25 public: |
| 24 // The callback is called when initialization is finished. The | 26 VideoReader(); |
| 25 // parameter is set to true on success. | |
| 26 typedef base::Callback<void(bool)> InitializedCallback; | |
| 27 | |
| 28 virtual ~VideoReader(); | 27 virtual ~VideoReader(); |
| 29 | 28 |
| 30 static scoped_ptr<VideoReader> Create(const SessionConfig& config); | 29 void set_video_stub(VideoStub* video_stub) { video_stub_ = video_stub; } |
|
Wez
2014/09/16 23:10:07
Why does this need a setter rather than being a co
Sergey Ulanov
2014/09/17 21:52:06
This is consistent with other channel dispatchers.
Wez
2014/09/18 00:23:54
Acknowledged.
| |
| 31 | |
| 32 // Initializies the reader. Doesn't take ownership of either |connection| | |
| 33 // or |video_stub|. | |
| 34 virtual void Init(Session* session, | |
| 35 VideoStub* video_stub, | |
| 36 const InitializedCallback& callback) = 0; | |
| 37 virtual bool is_connected() = 0; | |
| 38 | 30 |
| 39 protected: | 31 protected: |
| 40 VideoReader() { } | 32 // ChannelDispatcherBase overrides. |
| 33 virtual void OnInitialized() OVERRIDE; | |
| 41 | 34 |
| 42 private: | 35 private: |
| 36 void OnNewData(scoped_ptr<VideoPacket> packet, | |
| 37 const base::Closure& done_task); | |
|
Wez
2014/09/16 23:10:06
OnVideoPacket?
Sergey Ulanov
2014/09/17 21:52:06
Done.
| |
| 38 | |
| 39 StreamChannelFactory* channel_factory_; | |
|
Wez
2014/09/16 23:10:06
This doesn't seem to be used?
Sergey Ulanov
2014/09/17 21:52:06
Done.
| |
| 40 ProtobufMessageReader<VideoPacket> reader_; | |
|
Wez
2014/09/16 23:10:06
It ends up looking a little strange to have VideoR
Sergey Ulanov
2014/09/17 21:52:06
Renamed this class
| |
| 41 | |
| 42 // The stub that processes all received packets. | |
|
Wez
2014/09/16 23:10:06
Or "Interface to which VideoPackets are passed for
Sergey Ulanov
2014/09/17 21:52:06
Done.
| |
| 43 VideoStub* video_stub_; | |
| 44 | |
| 43 DISALLOW_COPY_AND_ASSIGN(VideoReader); | 45 DISALLOW_COPY_AND_ASSIGN(VideoReader); |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 } // namespace protocol | 48 } // namespace protocol |
| 47 } // namespace remoting | 49 } // namespace remoting |
| 48 | 50 |
| 49 #endif // REMOTING_PROTOCOL_VIDEO_READER_H_ | 51 #endif // REMOTING_PROTOCOL_VIDEO_READER_H_ |
| OLD | NEW |