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 #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/client/plugin/pepper_video_renderer_2d.h" | |
| 21 #include "remoting/protocol/video_stub.h" | 22 #include "remoting/protocol/video_stub.h" |
| 22 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 23 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 23 | 24 |
| 24 struct PPB_OpenGLES2; | 25 struct PPB_OpenGLES2; |
| 25 | 26 |
| 26 namespace remoting { | 27 namespace remoting { |
| 27 | 28 |
| 28 namespace protocol { | 29 namespace protocol { |
| 29 class FrameStatsConsumer; | 30 class FrameStatsConsumer; |
| 30 } // namespace protocol | 31 } // namespace protocol |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 54 // protocol::VideoStub interface. | 55 // protocol::VideoStub interface. |
| 55 void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet, | 56 void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet, |
| 56 const base::Closure& done) override; | 57 const base::Closure& done) override; |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 // Class responsible for tracking state of a frame until it's rendered. | 60 // Class responsible for tracking state of a frame until it's rendered. |
| 60 class FrameTracker; | 61 class FrameTracker; |
| 61 | 62 |
| 62 class Picture; | 63 class Picture; |
| 63 | 64 |
| 65 // A structure which contains OpenGl hardware limitations. | |
| 66 struct GlLimits { | |
|
Sergey Ulanov
2016/10/17 20:02:44
I don't think you really need this struct given th
Hzj_jie
2016/10/17 22:55:43
Done.
| |
| 67 int texture_size; | |
| 68 int viewport_size[2]; | |
| 69 }; | |
| 70 | |
| 64 // Callback for pp::VideoDecoder::Initialize(). | 71 // Callback for pp::VideoDecoder::Initialize(). |
| 65 void OnInitialized(int32_t result); | 72 void OnInitialized(int32_t result); |
| 66 | 73 |
| 67 // Passes one picture from |pending_frames_| to the |video_decoder_|. | 74 // Passes one picture from |pending_frames_| to the |video_decoder_|. |
| 68 void DecodeNextPacket(); | 75 void DecodeNextPacket(); |
| 69 | 76 |
| 70 // Callback for pp::VideoDecoder::Decode(). | 77 // Callback for pp::VideoDecoder::Decode(). |
| 71 void OnDecodeDone(int32_t result); | 78 void OnDecodeDone(int32_t result); |
| 72 | 79 |
| 73 // Fetches next picture from the |video_decoder_|. | 80 // Fetches next picture from the |video_decoder_|. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 std::list<std::unique_ptr<FrameTracker>> next_picture_frames_; | 136 std::list<std::unique_ptr<FrameTracker>> next_picture_frames_; |
| 130 | 137 |
| 131 // The current picture shown on the screen or being rendered. Must be deleted | 138 // The current picture shown on the screen or being rendered. Must be deleted |
| 132 // before |video_decoder_|. | 139 // before |video_decoder_|. |
| 133 std::unique_ptr<Picture> current_picture_; | 140 std::unique_ptr<Picture> current_picture_; |
| 134 | 141 |
| 135 // FrameTrackers for frames in |current_picture_|. The queue is emptied once | 142 // FrameTrackers for frames in |current_picture_|. The queue is emptied once |
| 136 // the |current_picture_| is rendered. | 143 // the |current_picture_| is rendered. |
| 137 std::list<std::unique_ptr<FrameTracker>> current_picture_frames_; | 144 std::list<std::unique_ptr<FrameTracker>> current_picture_frames_; |
| 138 | 145 |
| 146 // The fallback software renderer, if input video packet size is larger than | |
| 147 // hardware limitation. | |
| 148 PepperVideoRenderer2D fallback_renderer_; | |
| 149 bool use_fallback_renderer_ = false; | |
| 150 | |
| 139 // Set to true if the screen has been resized and needs to be repainted. | 151 // Set to true if the screen has been resized and needs to be repainted. |
| 140 bool force_repaint_ = false; | 152 bool force_repaint_ = false; |
| 141 | 153 |
| 142 // The texture type for which |shader_program| was initialized. Can be either | 154 // The texture type for which |shader_program| was initialized. Can be either |
| 143 // 0, GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB or GL_TEXTURE_EXTERNAL_OES. 0 | 155 // 0, GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB or GL_TEXTURE_EXTERNAL_OES. 0 |
| 144 // indicates that |shader_program_| hasn't been intialized. | 156 // indicates that |shader_program_| hasn't been intialized. |
| 145 uint32_t current_shader_program_texture_target_ = 0; | 157 uint32_t current_shader_program_texture_target_ = 0; |
| 146 | 158 |
| 147 // Shader program ID. | 159 // Shader program ID. |
| 148 unsigned int shader_program_ = 0; | 160 unsigned int shader_program_ = 0; |
| 149 | 161 |
| 150 // Location of the scale value to be passed to the |shader_program_|. | 162 // Location of the scale value to be passed to the |shader_program_|. |
| 151 int shader_texcoord_scale_location_ = 0; | 163 int shader_texcoord_scale_location_ = 0; |
| 152 | 164 |
| 153 // True if the renderer has received frame from the host. | 165 // True if the renderer has received frame from the host. |
| 154 bool frame_received_ = false; | 166 bool frame_received_ = false; |
| 155 | 167 |
| 156 // True if dirty regions are to be sent to |event_handler_| for debugging. | 168 // True if dirty regions are to be sent to |event_handler_| for debugging. |
| 157 bool debug_dirty_region_ = false; | 169 bool debug_dirty_region_ = false; |
| 158 | 170 |
| 159 pp::CompletionCallbackFactory<PepperVideoRenderer3D> callback_factory_; | 171 pp::CompletionCallbackFactory<PepperVideoRenderer3D> callback_factory_; |
| 160 | 172 |
| 173 // The hardware limitation. | |
| 174 GlLimits gl_limits_; | |
| 175 | |
| 161 DISALLOW_COPY_AND_ASSIGN(PepperVideoRenderer3D); | 176 DISALLOW_COPY_AND_ASSIGN(PepperVideoRenderer3D); |
| 162 }; | 177 }; |
| 163 | 178 |
| 164 } // namespace remoting | 179 } // namespace remoting |
| 165 | 180 |
| 166 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ | 181 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ |
| OLD | NEW |