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/client/plugin/pepper_video_renderer_3d.h" | 5 #include "remoting/client/plugin/pepper_video_renderer_3d.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 // 1.1, so we have to pass 0 for backwards compatibility with older versions of | 28 // 1.1, so we have to pass 0 for backwards compatibility with older versions of |
29 // the browser. Currently all API implementations allocate more than 3 buffers | 29 // the browser. Currently all API implementations allocate more than 3 buffers |
30 // by default. | 30 // by default. |
31 // | 31 // |
32 // TODO(sergeyu): Change this to 3 once PPB_VideoDecoder v1.1 is enabled on | 32 // TODO(sergeyu): Change this to 3 once PPB_VideoDecoder v1.1 is enabled on |
33 // stable channel (crbug.com/520323). | 33 // stable channel (crbug.com/520323). |
34 const uint32_t kMinimumPictureCount = 0; // 3 | 34 const uint32_t kMinimumPictureCount = 0; // 3 |
35 | 35 |
36 class PepperVideoRenderer3D::PendingPacket { | 36 class PepperVideoRenderer3D::PendingPacket { |
37 public: | 37 public: |
38 PendingPacket(scoped_ptr<VideoPacket> packet, const base::Closure& done) | 38 PendingPacket(std::unique_ptr<VideoPacket> packet, const base::Closure& done) |
39 : packet_(std::move(packet)), done_runner_(done) {} | 39 : packet_(std::move(packet)), done_runner_(done) {} |
40 | 40 |
41 ~PendingPacket() {} | 41 ~PendingPacket() {} |
42 | 42 |
43 const VideoPacket* packet() const { return packet_.get(); } | 43 const VideoPacket* packet() const { return packet_.get(); } |
44 | 44 |
45 private: | 45 private: |
46 scoped_ptr<VideoPacket> packet_; | 46 std::unique_ptr<VideoPacket> packet_; |
47 base::ScopedClosureRunner done_runner_; | 47 base::ScopedClosureRunner done_runner_; |
48 }; | 48 }; |
49 | 49 |
50 | 50 |
51 class PepperVideoRenderer3D::Picture { | 51 class PepperVideoRenderer3D::Picture { |
52 public: | 52 public: |
53 Picture(pp::VideoDecoder* decoder, PP_VideoPicture picture) | 53 Picture(pp::VideoDecoder* decoder, PP_VideoPicture picture) |
54 : decoder_(decoder), picture_(picture) {} | 54 : decoder_(decoder), picture_(picture) {} |
55 ~Picture() { decoder_->RecyclePicture(picture_); } | 55 ~Picture() { decoder_->RecyclePicture(picture_); } |
56 | 56 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return this; | 179 return this; |
180 } | 180 } |
181 | 181 |
182 protocol::FrameConsumer* PepperVideoRenderer3D::GetFrameConsumer() { | 182 protocol::FrameConsumer* PepperVideoRenderer3D::GetFrameConsumer() { |
183 // GetFrameConsumer() is used only for WebRTC-based connections which are not | 183 // GetFrameConsumer() is used only for WebRTC-based connections which are not |
184 // supported by the plugin. | 184 // supported by the plugin. |
185 NOTREACHED(); | 185 NOTREACHED(); |
186 return nullptr; | 186 return nullptr; |
187 } | 187 } |
188 | 188 |
189 void PepperVideoRenderer3D::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, | 189 void PepperVideoRenderer3D::ProcessVideoPacket( |
190 const base::Closure& done) { | 190 std::unique_ptr<VideoPacket> packet, |
| 191 const base::Closure& done) { |
191 base::ScopedClosureRunner done_runner(done); | 192 base::ScopedClosureRunner done_runner(done); |
192 | 193 |
193 perf_tracker_->RecordVideoPacketStats(*packet); | 194 perf_tracker_->RecordVideoPacketStats(*packet); |
194 | 195 |
195 // Don't need to do anything if the packet is empty. Host sends empty video | 196 // Don't need to do anything if the packet is empty. Host sends empty video |
196 // packets when the screen is not changing. | 197 // packets when the screen is not changing. |
197 if (!packet->data().size()) | 198 if (!packet->data().size()) |
198 return; | 199 return; |
199 | 200 |
200 if (packet->format().has_screen_width() && | 201 if (packet->format().has_screen_width() && |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); | 488 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); |
488 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); | 489 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); |
489 } | 490 } |
490 | 491 |
491 void PepperVideoRenderer3D::CheckGLError() { | 492 void PepperVideoRenderer3D::CheckGLError() { |
492 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); | 493 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); |
493 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; | 494 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; |
494 } | 495 } |
495 | 496 |
496 } // namespace remoting | 497 } // namespace remoting |
OLD | NEW |