Chromium Code Reviews| Index: remoting/protocol/video_reader.cc |
| diff --git a/remoting/protocol/video_reader.cc b/remoting/protocol/video_reader.cc |
| index 0dfa10ac02157f73661d5af103456fd40d224360..3001667c76efd8e2700d293246e51aab253b4753 100644 |
| --- a/remoting/protocol/video_reader.cc |
| +++ b/remoting/protocol/video_reader.cc |
| @@ -4,34 +4,32 @@ |
| #include "remoting/protocol/video_reader.h" |
| -#include "remoting/protocol/session_config.h" |
| -#include "remoting/protocol/protobuf_video_reader.h" |
| +#include "base/bind.h" |
| +#include "net/socket/stream_socket.h" |
| +#include "remoting/base/constants.h" |
| +#include "remoting/proto/video.pb.h" |
| +#include "remoting/protocol/stream_channel_factory.h" |
| +#include "remoting/protocol/video_stub.h" |
| namespace remoting { |
| namespace protocol { |
| -VideoReader::~VideoReader() { } |
| - |
| -// static |
| -scoped_ptr<VideoReader> VideoReader::Create(const SessionConfig& config) { |
| - const ChannelConfig& video_config = config.video_config(); |
| - if (video_config.transport == ChannelConfig::TRANSPORT_STREAM) { |
| - if (video_config.codec == ChannelConfig::CODEC_VP8) { |
| - return scoped_ptr<VideoReader>( |
| - new ProtobufVideoReader(VideoPacketFormat::ENCODING_VP8)); |
| - } else if (video_config.codec == ChannelConfig::CODEC_VP9) { |
| - return scoped_ptr<VideoReader>( |
| - new ProtobufVideoReader(VideoPacketFormat::ENCODING_VP9)); |
| - } else if (video_config.codec == ChannelConfig::CODEC_ZIP) { |
| - return scoped_ptr<VideoReader>( |
| - new ProtobufVideoReader(VideoPacketFormat::ENCODING_ZLIB)); |
| - } else if (video_config.codec == ChannelConfig::CODEC_VERBATIM) { |
| - return scoped_ptr<VideoReader>( |
| - new ProtobufVideoReader(VideoPacketFormat::ENCODING_VERBATIM)); |
| - } |
| - } |
| - NOTREACHED(); |
| - return scoped_ptr<VideoReader>(); |
| +VideoReader::VideoReader() |
| + : ChannelDispatcherBase(kVideoChannelName), |
|
Wez
2014/09/16 23:10:06
nit: Should the channel name be a parameter to the
Sergey Ulanov
2014/09/17 21:52:06
I don't think it needs to be - it's consistent wit
Wez
2014/09/18 00:23:54
Acknowledged.
|
| + video_stub_(NULL) { |
| +} |
| + |
| +VideoReader::~VideoReader() { |
| +} |
| + |
| +void VideoReader::OnInitialized() { |
| + reader_.Init(channel(), base::Bind(&VideoReader::OnNewData, |
| + base::Unretained(this))); |
| +} |
| + |
| +void VideoReader::OnNewData(scoped_ptr<VideoPacket> packet, |
| + const base::Closure& done_task) { |
| + video_stub_->ProcessVideoPacket(packet.Pass(), done_task); |
| } |
| } // namespace protocol |