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 "base/bind.h" |
9 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
10 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
11 #include "ppapi/c/pp_codecs.h" | 12 #include "ppapi/c/pp_codecs.h" |
12 #include "ppapi/c/ppb_opengles2.h" | 13 #include "ppapi/c/ppb_opengles2.h" |
13 #include "ppapi/cpp/instance.h" | 14 #include "ppapi/cpp/instance.h" |
14 #include "ppapi/lib/gl/include/GLES2/gl2.h" | 15 #include "ppapi/lib/gl/include/GLES2/gl2.h" |
15 #include "ppapi/lib/gl/include/GLES2/gl2ext.h" | 16 #include "ppapi/lib/gl/include/GLES2/gl2ext.h" |
16 #include "remoting/proto/video.pb.h" | 17 #include "remoting/proto/video.pb.h" |
17 #include "remoting/protocol/session_config.h" | 18 #include "remoting/protocol/session_config.h" |
18 | 19 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 graphics_, video_profile, PP_HARDWAREACCELERATION_WITHFALLBACK, | 171 graphics_, video_profile, PP_HARDWAREACCELERATION_WITHFALLBACK, |
171 callback_factory_.NewCallback(&PepperVideoRenderer3D::OnInitialized)); | 172 callback_factory_.NewCallback(&PepperVideoRenderer3D::OnInitialized)); |
172 CHECK_EQ(result, PP_OK_COMPLETIONPENDING) | 173 CHECK_EQ(result, PP_OK_COMPLETIONPENDING) |
173 << "video_decoder_.Initialize() returned " << result; | 174 << "video_decoder_.Initialize() returned " << result; |
174 } | 175 } |
175 | 176 |
176 ChromotingStats* PepperVideoRenderer3D::GetStats() { | 177 ChromotingStats* PepperVideoRenderer3D::GetStats() { |
177 return &stats_; | 178 return &stats_; |
178 } | 179 } |
179 | 180 |
180 void PepperVideoRenderer3D::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, | 181 void PepperVideoRenderer3D::ProcessVideoPacket( |
181 const base::Closure& done) { | 182 scoped_ptr<VideoPacket> packet, |
182 base::ScopedClosureRunner done_runner(done); | 183 const ProgressCallback& progress_callback) { |
| 184 base::ScopedClosureRunner done_runner( |
| 185 base::Bind(progress_callback, PacketProgress::DONE)); |
183 | 186 |
184 // Don't need to do anything if the packet is empty. Host sends empty video | 187 // Don't need to do anything if the packet is empty. Host sends empty video |
185 // packets when the screen is not changing. | 188 // packets when the screen is not changing. |
186 if (!packet->data().size()) | 189 if (!packet->data().size()) |
187 return; | 190 return; |
188 | 191 |
189 // Update statistics. | 192 // Update statistics. |
190 stats_.video_frame_rate()->Record(1); | 193 stats_.video_frame_rate()->Record(1); |
191 stats_.video_bandwidth()->Record(packet->data().size()); | 194 stats_.video_bandwidth()->Record(packet->data().size()); |
192 if (packet->has_capture_time_ms()) | 195 if (packet->has_capture_time_ms()) |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); | 511 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); |
509 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); | 512 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); |
510 } | 513 } |
511 | 514 |
512 void PepperVideoRenderer3D::CheckGLError() { | 515 void PepperVideoRenderer3D::CheckGLError() { |
513 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); | 516 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); |
514 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; | 517 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; |
515 } | 518 } |
516 | 519 |
517 } // namespace remoting | 520 } // namespace remoting |
OLD | NEW |