OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/codec/video_encoder_helper.h" | 5 #include "remoting/codec/video_encoder_helper.h" |
6 | 6 |
7 #include "remoting/proto/video.pb.h" | 7 #include "remoting/proto/video.pb.h" |
8 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 8 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
9 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 9 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
10 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" | 10 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" |
11 | 11 |
12 namespace remoting { | 12 namespace remoting { |
13 | 13 |
14 VideoEncoderHelper::VideoEncoderHelper() {} | 14 VideoEncoderHelper::VideoEncoderHelper() {} |
15 | 15 |
16 scoped_ptr<VideoPacket> VideoEncoderHelper::CreateVideoPacket( | 16 std::unique_ptr<VideoPacket> VideoEncoderHelper::CreateVideoPacket( |
17 const webrtc::DesktopFrame& frame) { | 17 const webrtc::DesktopFrame& frame) { |
18 return CreateVideoPacketWithUpdatedRegion(frame, frame.updated_region()); | 18 return CreateVideoPacketWithUpdatedRegion(frame, frame.updated_region()); |
19 } | 19 } |
20 | 20 |
21 scoped_ptr<VideoPacket> | 21 std::unique_ptr<VideoPacket> |
22 VideoEncoderHelper::CreateVideoPacketWithUpdatedRegion( | 22 VideoEncoderHelper::CreateVideoPacketWithUpdatedRegion( |
23 const webrtc::DesktopFrame& frame, | 23 const webrtc::DesktopFrame& frame, |
24 const webrtc::DesktopRegion& updated_region) { | 24 const webrtc::DesktopRegion& updated_region) { |
25 scoped_ptr<VideoPacket> packet(new VideoPacket()); | 25 std::unique_ptr<VideoPacket> packet(new VideoPacket()); |
26 | 26 |
27 // Set |screen_width| and |screen_height| iff they have changed. | 27 // Set |screen_width| and |screen_height| iff they have changed. |
28 if (!frame.size().equals(screen_size_)) { | 28 if (!frame.size().equals(screen_size_)) { |
29 screen_size_ = frame.size(); | 29 screen_size_ = frame.size(); |
30 | 30 |
31 VideoPacketFormat* format = packet->mutable_format(); | 31 VideoPacketFormat* format = packet->mutable_format(); |
32 format->set_screen_width(screen_size_.width()); | 32 format->set_screen_width(screen_size_.width()); |
33 format->set_screen_height(screen_size_.height()); | 33 format->set_screen_height(screen_size_.height()); |
34 } | 34 } |
35 | 35 |
(...skipping 11 matching lines...) Expand all Loading... |
47 // Store frame DPI. | 47 // Store frame DPI. |
48 if (!frame.dpi().is_zero()) { | 48 if (!frame.dpi().is_zero()) { |
49 packet->mutable_format()->set_x_dpi(frame.dpi().x()); | 49 packet->mutable_format()->set_x_dpi(frame.dpi().x()); |
50 packet->mutable_format()->set_y_dpi(frame.dpi().y()); | 50 packet->mutable_format()->set_y_dpi(frame.dpi().y()); |
51 } | 51 } |
52 | 52 |
53 return packet; | 53 return packet; |
54 } | 54 } |
55 | 55 |
56 } // namespace remoting | 56 } // namespace remoting |
OLD | NEW |