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 <deque> | 10 #include <deque> |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "base/callback.h" | 14 #include "base/callback.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.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 |
(...skipping 14 matching lines...) Expand all Loading... |
40 protocol::PerformanceTracker* perf_tracker) override; | 40 protocol::PerformanceTracker* perf_tracker) override; |
41 void OnViewChanged(const pp::View& view) override; | 41 void OnViewChanged(const pp::View& view) override; |
42 void EnableDebugDirtyRegion(bool enable) override; | 42 void EnableDebugDirtyRegion(bool enable) override; |
43 | 43 |
44 // VideoRenderer interface. | 44 // VideoRenderer interface. |
45 void OnSessionConfig(const protocol::SessionConfig& config) override; | 45 void OnSessionConfig(const protocol::SessionConfig& config) override; |
46 protocol::VideoStub* GetVideoStub() override; | 46 protocol::VideoStub* GetVideoStub() override; |
47 protocol::FrameConsumer* GetFrameConsumer() override; | 47 protocol::FrameConsumer* GetFrameConsumer() override; |
48 | 48 |
49 // protocol::VideoStub interface. | 49 // protocol::VideoStub interface. |
50 void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, | 50 void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet, |
51 const base::Closure& done) override; | 51 const base::Closure& done) override; |
52 | 52 |
53 private: | 53 private: |
54 class PendingPacket; | 54 class PendingPacket; |
55 class Picture; | 55 class Picture; |
56 | 56 |
57 // Callback for pp::VideoDecoder::Initialize(). | 57 // Callback for pp::VideoDecoder::Initialize(). |
58 void OnInitialized(int32_t result); | 58 void OnInitialized(int32_t result); |
59 | 59 |
60 // Passes one picture from |pending_packets_| to the |video_decoder_|. | 60 // Passes one picture from |pending_packets_| to the |video_decoder_|. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 bool decode_pending_ = false; | 104 bool decode_pending_ = false; |
105 bool get_picture_pending_ = false; | 105 bool get_picture_pending_ = false; |
106 bool paint_pending_ = false; | 106 bool paint_pending_ = false; |
107 | 107 |
108 // Queue of packets that that have been received, but haven't been passed to | 108 // Queue of packets that that have been received, but haven't been passed to |
109 // the decoder yet. | 109 // the decoder yet. |
110 std::deque<PendingPacket*> pending_packets_; | 110 std::deque<PendingPacket*> pending_packets_; |
111 | 111 |
112 // The current picture shown on the screen or being rendered. Must be deleted | 112 // The current picture shown on the screen or being rendered. Must be deleted |
113 // before |video_decoder_|. | 113 // before |video_decoder_|. |
114 scoped_ptr<Picture> current_picture_; | 114 std::unique_ptr<Picture> current_picture_; |
115 | 115 |
116 // The next picture to be rendered. PaintIfNeeded() will copy it to | 116 // The next picture to be rendered. PaintIfNeeded() will copy it to |
117 // |current_picture_| and render it after that. Must be deleted | 117 // |current_picture_| and render it after that. Must be deleted |
118 // before |video_decoder_|. | 118 // before |video_decoder_|. |
119 scoped_ptr<Picture> next_picture_; | 119 std::unique_ptr<Picture> next_picture_; |
120 | 120 |
121 // Set to true if the screen has been resized and needs to be repainted. | 121 // Set to true if the screen has been resized and needs to be repainted. |
122 bool force_repaint_ = false; | 122 bool force_repaint_ = false; |
123 | 123 |
124 // The texture type for which |shader_program| was initialized. Can be either | 124 // The texture type for which |shader_program| was initialized. Can be either |
125 // 0, GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB or GL_TEXTURE_EXTERNAL_OES. 0 | 125 // 0, GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB or GL_TEXTURE_EXTERNAL_OES. 0 |
126 // indicates that |shader_program_| hasn't been intialized. | 126 // indicates that |shader_program_| hasn't been intialized. |
127 uint32_t current_shader_program_texture_target_ = 0; | 127 uint32_t current_shader_program_texture_target_ = 0; |
128 | 128 |
129 // Shader program ID. | 129 // Shader program ID. |
130 unsigned int shader_program_ = 0; | 130 unsigned int shader_program_ = 0; |
131 | 131 |
132 // Location of the scale value to be passed to the |shader_program_|. | 132 // Location of the scale value to be passed to the |shader_program_|. |
133 int shader_texcoord_scale_location_ = 0; | 133 int shader_texcoord_scale_location_ = 0; |
134 | 134 |
135 // True if dirty regions are to be sent to |event_handler_| for debugging. | 135 // True if dirty regions are to be sent to |event_handler_| for debugging. |
136 bool debug_dirty_region_ = false; | 136 bool debug_dirty_region_ = false; |
137 | 137 |
138 pp::CompletionCallbackFactory<PepperVideoRenderer3D> callback_factory_; | 138 pp::CompletionCallbackFactory<PepperVideoRenderer3D> callback_factory_; |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(PepperVideoRenderer3D); | 140 DISALLOW_COPY_AND_ASSIGN(PepperVideoRenderer3D); |
141 }; | 141 }; |
142 | 142 |
143 } // namespace remoting | 143 } // namespace remoting |
144 | 144 |
145 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ | 145 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ |
OLD | NEW |