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