Chromium Code Reviews| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 PP_VideoPicture picture_; | 71 PP_VideoPicture picture_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 PepperVideoRenderer3D::PepperVideoRenderer3D() : callback_factory_(this) {} | 74 PepperVideoRenderer3D::PepperVideoRenderer3D() : callback_factory_(this) {} |
| 75 | 75 |
| 76 PepperVideoRenderer3D::~PepperVideoRenderer3D() { | 76 PepperVideoRenderer3D::~PepperVideoRenderer3D() { |
| 77 if (shader_program_) | 77 if (shader_program_) |
| 78 gles2_if_->DeleteProgram(graphics_.pp_resource(), shader_program_); | 78 gles2_if_->DeleteProgram(graphics_.pp_resource(), shader_program_); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool PepperVideoRenderer3D::Initialize( | 81 bool PepperVideoRenderer3D::SetPepperContext( |
|
Sergey Ulanov
2016/06/28 19:08:01
It's strange that Set* method returns boolean valu
Yuwei
2016/06/28 21:43:03
Done. Store pp::Instance* here and use later in In
| |
| 82 pp::Instance* instance, | 82 pp::Instance* instance, |
| 83 const ClientContext& context, | 83 EventHandler* event_handler) { |
| 84 EventHandler* event_handler, | |
| 85 protocol::PerformanceTracker* perf_tracker) { | |
| 86 DCHECK(event_handler); | 84 DCHECK(event_handler); |
| 87 DCHECK(!event_handler_); | 85 DCHECK(!event_handler_); |
| 88 | 86 |
| 89 event_handler_ = event_handler; | 87 event_handler_ = event_handler; |
| 90 perf_tracker_ = perf_tracker; | |
| 91 | 88 |
| 92 const int32_t context_attributes[] = { | 89 const int32_t context_attributes[] = { |
| 93 PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, | 90 PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, |
| 94 PP_GRAPHICS3DATTRIB_BLUE_SIZE, 8, | 91 PP_GRAPHICS3DATTRIB_BLUE_SIZE, 8, |
| 95 PP_GRAPHICS3DATTRIB_GREEN_SIZE, 8, | 92 PP_GRAPHICS3DATTRIB_GREEN_SIZE, 8, |
| 96 PP_GRAPHICS3DATTRIB_RED_SIZE, 8, | 93 PP_GRAPHICS3DATTRIB_RED_SIZE, 8, |
| 97 PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 0, | 94 PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 0, |
| 98 PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 0, | 95 PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 0, |
| 99 PP_GRAPHICS3DATTRIB_SAMPLES, 0, | 96 PP_GRAPHICS3DATTRIB_SAMPLES, 0, |
| 100 PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, | 97 PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 graphics_.ResizeBuffers(view_size_.width(), view_size_.height()); | 151 graphics_.ResizeBuffers(view_size_.width(), view_size_.height()); |
| 155 | 152 |
| 156 force_repaint_ = true; | 153 force_repaint_ = true; |
| 157 PaintIfNeeded(); | 154 PaintIfNeeded(); |
| 158 } | 155 } |
| 159 | 156 |
| 160 void PepperVideoRenderer3D::EnableDebugDirtyRegion(bool enable) { | 157 void PepperVideoRenderer3D::EnableDebugDirtyRegion(bool enable) { |
| 161 debug_dirty_region_ = enable; | 158 debug_dirty_region_ = enable; |
| 162 } | 159 } |
| 163 | 160 |
| 161 bool PepperVideoRenderer3D::Initialize( | |
| 162 const ClientContext& context, | |
| 163 protocol::PerformanceTracker* perf_tracker) { | |
| 164 perf_tracker_ = perf_tracker; | |
| 165 return true; | |
| 166 } | |
| 167 | |
| 164 void PepperVideoRenderer3D::OnSessionConfig( | 168 void PepperVideoRenderer3D::OnSessionConfig( |
| 165 const protocol::SessionConfig& config) { | 169 const protocol::SessionConfig& config) { |
| 166 PP_VideoProfile video_profile = PP_VIDEOPROFILE_VP8_ANY; | 170 PP_VideoProfile video_profile = PP_VIDEOPROFILE_VP8_ANY; |
| 167 switch (config.video_config().codec) { | 171 switch (config.video_config().codec) { |
| 168 case protocol::ChannelConfig::CODEC_VP8: | 172 case protocol::ChannelConfig::CODEC_VP8: |
| 169 video_profile = PP_VIDEOPROFILE_VP8_ANY; | 173 video_profile = PP_VIDEOPROFILE_VP8_ANY; |
| 170 break; | 174 break; |
| 171 case protocol::ChannelConfig::CODEC_VP9: | 175 case protocol::ChannelConfig::CODEC_VP9: |
| 172 video_profile = PP_VIDEOPROFILE_VP9_ANY; | 176 video_profile = PP_VIDEOPROFILE_VP9_ANY; |
| 173 break; | 177 break; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); | 519 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); |
| 516 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); | 520 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); |
| 517 } | 521 } |
| 518 | 522 |
| 519 void PepperVideoRenderer3D::CheckGLError() { | 523 void PepperVideoRenderer3D::CheckGLError() { |
| 520 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); | 524 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); |
| 521 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; | 525 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; |
| 522 } | 526 } |
| 523 | 527 |
| 524 } // namespace remoting | 528 } // namespace remoting |
| OLD | NEW |