| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "remoting/protocol/protobuf_video_reader.h" | 5 #include "remoting/protocol/protobuf_video_reader.h" |
| 6 | 6 |
| 7 #include "base/task.h" | 7 #include "base/task.h" |
| 8 #include "remoting/proto/video.pb.h" | 8 #include "remoting/proto/video.pb.h" |
| 9 #include "remoting/protocol/session.h" | 9 #include "remoting/protocol/session.h" |
| 10 | 10 |
| 11 namespace remoting { | 11 namespace remoting { |
| 12 namespace protocol { | 12 namespace protocol { |
| 13 | 13 |
| 14 ProtobufVideoReader::ProtobufVideoReader(VideoPacketFormat::Encoding encoding) | 14 ProtobufVideoReader::ProtobufVideoReader(VideoPacketFormat::Encoding encoding) |
| 15 : encoding_(encoding) { | 15 : encoding_(encoding) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 ProtobufVideoReader::~ProtobufVideoReader() { } | 18 ProtobufVideoReader::~ProtobufVideoReader() { } |
| 19 | 19 |
| 20 void ProtobufVideoReader::Init(protocol::Session* session, | 20 void ProtobufVideoReader::Init(protocol::Session* session, |
| 21 VideoStub* video_stub) { | 21 VideoStub* video_stub) { |
| 22 reader_.Init<VideoPacket>( | 22 reader_.Init( |
| 23 session->video_channel(), | 23 session->video_channel(), |
| 24 NewCallback(this, &ProtobufVideoReader::OnNewData)); | 24 NewCallback(this, &ProtobufVideoReader::OnNewData)); |
| 25 video_stub_ = video_stub; | 25 video_stub_ = video_stub; |
| 26 } | 26 } |
| 27 | 27 |
| 28 void ProtobufVideoReader::Close() { | |
| 29 reader_.Close(); | |
| 30 } | |
| 31 | |
| 32 void ProtobufVideoReader::OnNewData(VideoPacket* packet) { | 28 void ProtobufVideoReader::OnNewData(VideoPacket* packet) { |
| 33 video_stub_->ProcessVideoPacket(packet, new DeleteTask<VideoPacket>(packet)); | 29 video_stub_->ProcessVideoPacket(packet, new DeleteTask<VideoPacket>(packet)); |
| 34 } | 30 } |
| 35 | 31 |
| 36 } // namespace protocol | 32 } // namespace protocol |
| 37 } // namespace remoting | 33 } // namespace remoting |
| OLD | NEW |