| 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 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ |
| 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ | 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "ppapi/cpp/graphics_3d.h" | 16 #include "ppapi/cpp/graphics_3d.h" |
| 17 #include "ppapi/cpp/instance_handle.h" | 17 #include "ppapi/cpp/instance_handle.h" |
| 18 #include "ppapi/cpp/video_decoder.h" | 18 #include "ppapi/cpp/video_decoder.h" |
| 19 #include "ppapi/utility/completion_callback_factory.h" | 19 #include "ppapi/utility/completion_callback_factory.h" |
| 20 #include "remoting/client/plugin/pepper_video_renderer.h" | 20 #include "remoting/client/plugin/pepper_video_renderer.h" |
| 21 #include "remoting/protocol/video_stub.h" | 21 #include "remoting/protocol/video_stub.h" |
| 22 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 22 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 23 | 23 |
| 24 struct PPB_OpenGLES2; | 24 struct PPB_OpenGLES2; |
| 25 | 25 |
| 26 namespace remoting { | 26 namespace remoting { |
| 27 | 27 |
| 28 namespace protocol { |
| 29 class FrameStatsConsumer; |
| 30 } // namespace protocol |
| 31 |
| 28 // PepperVideoRenderer that uses the PPB_VideoDecoder interface for video | 32 // PepperVideoRenderer that uses the PPB_VideoDecoder interface for video |
| 29 // decoding and Graphics3D for rendering. | 33 // decoding and Graphics3D for rendering. |
| 30 class PepperVideoRenderer3D : public PepperVideoRenderer, | 34 class PepperVideoRenderer3D : public PepperVideoRenderer, |
| 31 public protocol::VideoStub { | 35 public protocol::VideoStub { |
| 32 public: | 36 public: |
| 33 PepperVideoRenderer3D(); | 37 PepperVideoRenderer3D(); |
| 34 ~PepperVideoRenderer3D() override; | 38 ~PepperVideoRenderer3D() override; |
| 35 | 39 |
| 36 // PepperVideoRenderer interface. | 40 // PepperVideoRenderer interface. |
| 37 void SetPepperContext(pp::Instance* instance, | 41 void SetPepperContext(pp::Instance* instance, |
| 38 EventHandler* event_handler) override; | 42 EventHandler* event_handler) override; |
| 39 void OnViewChanged(const pp::View& view) override; | 43 void OnViewChanged(const pp::View& view) override; |
| 40 void EnableDebugDirtyRegion(bool enable) override; | 44 void EnableDebugDirtyRegion(bool enable) override; |
| 41 | 45 |
| 42 // VideoRenderer interface. | 46 // VideoRenderer interface. |
| 43 bool Initialize(const ClientContext& client_context, | 47 bool Initialize(const ClientContext& client_context, |
| 44 protocol::PerformanceTracker* perf_tracker) override; | 48 protocol::FrameStatsConsumer* stats_consumer) override; |
| 45 void OnSessionConfig(const protocol::SessionConfig& config) override; | 49 void OnSessionConfig(const protocol::SessionConfig& config) override; |
| 46 protocol::VideoStub* GetVideoStub() override; | 50 protocol::VideoStub* GetVideoStub() override; |
| 47 protocol::FrameConsumer* GetFrameConsumer() override; | 51 protocol::FrameConsumer* GetFrameConsumer() override; |
| 52 protocol::FrameStatsConsumer* GetFrameStatsConsumer() override; |
| 48 | 53 |
| 49 // protocol::VideoStub interface. | 54 // protocol::VideoStub interface. |
| 50 void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet, | 55 void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet, |
| 51 const base::Closure& done) override; | 56 const base::Closure& done) override; |
| 52 | 57 |
| 53 private: | 58 private: |
| 54 // Class responsible for tracking state of a frame until it's rendered. | 59 // Class responsible for tracking state of a frame until it's rendered. |
| 55 class FrameTracker; | 60 class FrameTracker; |
| 56 | 61 |
| 57 class Picture; | 62 class Picture; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 86 void CreateProgram(const char* vertex_shader, const char* fragment_shader); | 91 void CreateProgram(const char* vertex_shader, const char* fragment_shader); |
| 87 | 92 |
| 88 // Creates a new shader and compiles |source| for it. | 93 // Creates a new shader and compiles |source| for it. |
| 89 void CreateShaderProgram(int type, const char* source); | 94 void CreateShaderProgram(int type, const char* source); |
| 90 | 95 |
| 91 // CHECKs that the last OpenGL call has completed successfully. | 96 // CHECKs that the last OpenGL call has completed successfully. |
| 92 void CheckGLError(); | 97 void CheckGLError(); |
| 93 | 98 |
| 94 pp::Instance* pp_instance_ = nullptr; | 99 pp::Instance* pp_instance_ = nullptr; |
| 95 EventHandler* event_handler_ = nullptr; | 100 EventHandler* event_handler_ = nullptr; |
| 96 protocol::PerformanceTracker* perf_tracker_ = nullptr; | 101 protocol::FrameStatsConsumer* stats_consumer_ = nullptr; |
| 97 | 102 |
| 98 pp::Graphics3D graphics_; | 103 pp::Graphics3D graphics_; |
| 99 const PPB_OpenGLES2* gles2_if_; | 104 const PPB_OpenGLES2* gles2_if_; |
| 100 pp::VideoDecoder video_decoder_; | 105 pp::VideoDecoder video_decoder_; |
| 101 | 106 |
| 102 webrtc::DesktopSize frame_size_; | 107 webrtc::DesktopSize frame_size_; |
| 103 | 108 |
| 104 webrtc::DesktopSize view_size_; | 109 webrtc::DesktopSize view_size_; |
| 105 | 110 |
| 106 bool initialization_finished_ = false; | 111 bool initialization_finished_ = false; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 bool debug_dirty_region_ = false; | 157 bool debug_dirty_region_ = false; |
| 153 | 158 |
| 154 pp::CompletionCallbackFactory<PepperVideoRenderer3D> callback_factory_; | 159 pp::CompletionCallbackFactory<PepperVideoRenderer3D> callback_factory_; |
| 155 | 160 |
| 156 DISALLOW_COPY_AND_ASSIGN(PepperVideoRenderer3D); | 161 DISALLOW_COPY_AND_ASSIGN(PepperVideoRenderer3D); |
| 157 }; | 162 }; |
| 158 | 163 |
| 159 } // namespace remoting | 164 } // namespace remoting |
| 160 | 165 |
| 161 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ | 166 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ |
| OLD | NEW |