| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_writer.h" | 5 #include "remoting/protocol/protobuf_video_writer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "net/socket/stream_socket.h" | 9 #include "net/socket/stream_socket.h" |
| 10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
| 11 #include "remoting/proto/video.pb.h" | 11 #include "remoting/proto/video.pb.h" |
| 12 #include "remoting/protocol/rtp_writer.h" | |
| 13 #include "remoting/protocol/session.h" | 12 #include "remoting/protocol/session.h" |
| 14 #include "remoting/protocol/util.h" | 13 #include "remoting/protocol/util.h" |
| 15 | 14 |
| 16 namespace remoting { | 15 namespace remoting { |
| 17 namespace protocol { | 16 namespace protocol { |
| 18 | 17 |
| 19 ProtobufVideoWriter::ProtobufVideoWriter(base::MessageLoopProxy* message_loop) | 18 ProtobufVideoWriter::ProtobufVideoWriter(base::MessageLoopProxy* message_loop) |
| 20 : buffered_writer_(new BufferedSocketWriter(message_loop)) { | 19 : buffered_writer_(new BufferedSocketWriter(message_loop)) { |
| 21 } | 20 } |
| 22 | 21 |
| 23 ProtobufVideoWriter::~ProtobufVideoWriter() { } | 22 ProtobufVideoWriter::~ProtobufVideoWriter() { |
| 23 Close(); |
| 24 } |
| 24 | 25 |
| 25 void ProtobufVideoWriter::Init(protocol::Session* session, | 26 void ProtobufVideoWriter::Init(protocol::Session* session, |
| 26 const InitializedCallback& callback) { | 27 const InitializedCallback& callback) { |
| 27 initialized_callback_ = callback; | 28 initialized_callback_ = callback; |
| 28 | 29 |
| 29 session->CreateStreamChannel( | 30 session->CreateStreamChannel( |
| 30 kVideoChannelName, | 31 kVideoChannelName, |
| 31 base::Bind(&ProtobufVideoWriter::OnChannelReady, base::Unretained(this))); | 32 base::Bind(&ProtobufVideoWriter::OnChannelReady, base::Unretained(this))); |
| 32 } | 33 } |
| 33 | 34 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 54 const base::Closure& done) { | 55 const base::Closure& done) { |
| 55 buffered_writer_->Write(SerializeAndFrameMessage(*packet), done); | 56 buffered_writer_->Write(SerializeAndFrameMessage(*packet), done); |
| 56 } | 57 } |
| 57 | 58 |
| 58 int ProtobufVideoWriter::GetPendingPackets() { | 59 int ProtobufVideoWriter::GetPendingPackets() { |
| 59 return buffered_writer_->GetBufferChunks(); | 60 return buffered_writer_->GetBufferChunks(); |
| 60 } | 61 } |
| 61 | 62 |
| 62 } // namespace protocol | 63 } // namespace protocol |
| 63 } // namespace remoting | 64 } // namespace remoting |
| OLD | NEW |