| 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/rtp_video_reader.h" | 5 #include "remoting/protocol/rtp_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/protocol/session.h" | 9 #include "remoting/protocol/session.h" |
| 9 | 10 |
| 10 namespace remoting { | 11 namespace remoting { |
| 11 namespace protocol { | 12 namespace protocol { |
| 12 | 13 |
| 13 RtpVideoReader::RtpVideoReader() { } | 14 RtpVideoReader::RtpVideoReader() { } |
| 14 RtpVideoReader::~RtpVideoReader() { } | 15 RtpVideoReader::~RtpVideoReader() { } |
| 15 | 16 |
| 16 void RtpVideoReader::Init(protocol::Session* session, | 17 void RtpVideoReader::Init(protocol::Session* session, VideoStub* video_stub) { |
| 17 VideoStub* video_stub) { | |
| 18 rtp_reader_.Init(session->video_rtp_channel(), | 18 rtp_reader_.Init(session->video_rtp_channel(), |
| 19 NewCallback(this, &RtpVideoReader::OnRtpPacket)); | 19 NewCallback(this, &RtpVideoReader::OnRtpPacket)); |
| 20 video_stub_ = video_stub; | 20 video_stub_ = video_stub; |
| 21 } | 21 } |
| 22 | 22 |
| 23 void RtpVideoReader::Close() { | 23 void RtpVideoReader::Close() { |
| 24 rtp_reader_.Close(); | 24 rtp_reader_.Close(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void RtpVideoReader::OnRtpPacket(const RtpPacket& rtp_packet) { | 27 void RtpVideoReader::OnRtpPacket(const RtpPacket& rtp_packet) { |
| 28 VideoPacket* packet = new VideoPacket(); | 28 VideoPacket* packet = new VideoPacket(); |
| 29 |
| 29 packet->set_data(rtp_packet.payload, rtp_packet.payload_size); | 30 packet->set_data(rtp_packet.payload, rtp_packet.payload_size); |
| 30 | |
| 31 packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8); | 31 packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8); |
| 32 packet->set_flags(rtp_packet.header.marker ? VideoPacket::LAST_PACKET : 0); | 32 packet->set_flags(rtp_packet.header.marker ? VideoPacket::LAST_PACKET : 0); |
| 33 packet->mutable_format()->set_pixel_format(PIXEL_FORMAT_RGB32); | |
| 34 packet->mutable_format()->set_x(0); | |
| 35 packet->mutable_format()->set_y(0); | |
| 36 packet->mutable_format()->set_width(800); | |
| 37 packet->mutable_format()->set_height(600); | |
| 38 | 33 |
| 39 video_stub_->ProcessVideoPacket(packet, new DeleteTask<VideoPacket>(packet)); | 34 video_stub_->ProcessVideoPacket(packet, new DeleteTask<VideoPacket>(packet)); |
| 40 } | 35 } |
| 41 | 36 |
| 42 } // namespace protocol | 37 } // namespace protocol |
| 43 } // namespace remoting | 38 } // namespace remoting |
| OLD | NEW |