| 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_writer.h" | 5 #include "remoting/protocol/protobuf_video_writer.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/rtp_writer.h" | 9 #include "remoting/protocol/rtp_writer.h" |
| 10 #include "remoting/protocol/session.h" | 10 #include "remoting/protocol/session.h" |
| 11 #include "remoting/protocol/util.h" | 11 #include "remoting/protocol/util.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 namespace protocol { | 14 namespace protocol { |
| 15 | 15 |
| 16 ProtobufVideoWriter::ProtobufVideoWriter() { } | 16 ProtobufVideoWriter::ProtobufVideoWriter() { } |
| 17 | 17 |
| 18 ProtobufVideoWriter::~ProtobufVideoWriter() { } | 18 ProtobufVideoWriter::~ProtobufVideoWriter() { } |
| 19 | 19 |
| 20 void ProtobufVideoWriter::Init(protocol::Session* session) { | 20 void ProtobufVideoWriter::Init(protocol::Session* session) { |
| 21 buffered_writer_ = new BufferedSocketWriter(); | 21 buffered_writer_ = new BufferedSocketWriter(); |
| 22 // TODO(sergeyu): Provide WriteFailedCallback for the buffered writer. | 22 // TODO(sergeyu): Provide WriteFailedCallback for the buffered writer. |
| 23 buffered_writer_->Init(session->video_channel(), NULL); | 23 buffered_writer_->Init(session->video_channel(), NULL); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void ProtobufVideoWriter::Close() { |
| 27 buffered_writer_->Close(); |
| 28 } |
| 29 |
| 26 void ProtobufVideoWriter::ProcessVideoPacket(const VideoPacket* packet, | 30 void ProtobufVideoWriter::ProcessVideoPacket(const VideoPacket* packet, |
| 27 Task* done) { | 31 Task* done) { |
| 28 buffered_writer_->Write(SerializeAndFrameMessage(*packet), done); | 32 buffered_writer_->Write(SerializeAndFrameMessage(*packet), done); |
| 29 } | 33 } |
| 30 | 34 |
| 31 int ProtobufVideoWriter::GetPendingPackets() { | 35 int ProtobufVideoWriter::GetPendingPackets() { |
| 32 return buffered_writer_->GetBufferChunks(); | 36 return buffered_writer_->GetBufferChunks(); |
| 33 } | 37 } |
| 34 | 38 |
| 35 } // namespace protocol | 39 } // namespace protocol |
| 36 } // namespace remoting | 40 } // namespace remoting |
| OLD | NEW |