Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(610)

Side by Side Diff: remoting/client/plugin/pepper_video_renderer_3d.h

Issue 2096643003: Rework PerformanceTracker to make it usable with WebRTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <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"
(...skipping 23 matching lines...) Expand all
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(std::unique_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 responsible for tracking state of a frame until it's rendered.
55 class FrameTracker;
56
55 class Picture; 57 class Picture;
56 58
57 // Callback for pp::VideoDecoder::Initialize(). 59 // Callback for pp::VideoDecoder::Initialize().
58 void OnInitialized(int32_t result); 60 void OnInitialized(int32_t result);
59 61
60 // Passes one picture from |pending_packets_| to the |video_decoder_|. 62 // Passes one picture from |pending_frames_| to the |video_decoder_|.
61 void DecodeNextPacket(); 63 void DecodeNextPacket();
62 64
63 // Callback for pp::VideoDecoder::Decode(). 65 // Callback for pp::VideoDecoder::Decode().
64 void OnDecodeDone(int32_t result); 66 void OnDecodeDone(int32_t result);
65 67
66 // Fetches next picture from the |video_decoder_|. 68 // Fetches next picture from the |video_decoder_|.
67 void GetNextPicture(); 69 void GetNextPicture();
68 70
69 // Callback for pp::VideoDecoder::GetPicture(). 71 // Callback for pp::VideoDecoder::GetPicture().
70 void OnPictureReady(int32_t result, PP_VideoPicture picture); 72 void OnPictureReady(int32_t result, PP_VideoPicture picture);
(...skipping 27 matching lines...) Expand all
98 100
99 webrtc::DesktopSize frame_size_; 101 webrtc::DesktopSize frame_size_;
100 102
101 webrtc::DesktopSize view_size_; 103 webrtc::DesktopSize view_size_;
102 104
103 bool initialization_finished_ = false; 105 bool initialization_finished_ = false;
104 bool decode_pending_ = false; 106 bool decode_pending_ = false;
105 bool get_picture_pending_ = false; 107 bool get_picture_pending_ = false;
106 bool paint_pending_ = false; 108 bool paint_pending_ = false;
107 109
108 // Queue of packets that that have been received, but haven't been passed to 110 // Queue of packets that that have been received, but haven't been passed to
Jamie 2016/06/24 23:53:21 s/Queue/List/ (or just remove "List of" from this
Sergey Ulanov 2016/06/25 05:34:03 Done.
109 // the decoder yet. 111 // the decoder yet.
110 std::deque<PendingPacket*> pending_packets_; 112 std::list<std::unique_ptr<FrameTracker>> pending_frames_;
111 113
112 // The current picture shown on the screen or being rendered. Must be deleted 114 // List of frames that have been decoded but for which we haven't received the
113 // before |video_decoder_|. 115 // pictures yet.
114 std::unique_ptr<Picture> current_picture_; 116 std::list<std::unique_ptr<FrameTracker>> decoded_frames_;
115 117
116 // The next picture to be rendered. PaintIfNeeded() will copy it to 118 // The next picture to be rendered. PaintIfNeeded() will copy it to
117 // |current_picture_| and render it after that. Must be deleted 119 // |current_picture_| and render it after that. Must be deleted
118 // before |video_decoder_|. 120 // before |video_decoder_|.
119 std::unique_ptr<Picture> next_picture_; 121 std::unique_ptr<Picture> next_picture_;
120 122
123 // FrameTracker instances in |next_picture_|.
124 std::list<std::unique_ptr<FrameTracker>> next_picture_frames_;
125
126 // The current picture shown on the screen or being rendered. Must be deleted
127 // before |video_decoder_|.
128 std::unique_ptr<Picture> current_picture_;
129
130 // FrameTrackers for frames in |current_picture_|. The queue is emptied once
131 // the |current_picture_| is rendered.
132 std::list<std::unique_ptr<FrameTracker>> current_picture_frames_;
133
121 // Set to true if the screen has been resized and needs to be repainted. 134 // Set to true if the screen has been resized and needs to be repainted.
122 bool force_repaint_ = false; 135 bool force_repaint_ = false;
123 136
124 // The texture type for which |shader_program| was initialized. Can be either 137 // 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 138 // 0, GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB or GL_TEXTURE_EXTERNAL_OES. 0
126 // indicates that |shader_program_| hasn't been intialized. 139 // indicates that |shader_program_| hasn't been intialized.
127 uint32_t current_shader_program_texture_target_ = 0; 140 uint32_t current_shader_program_texture_target_ = 0;
128 141
129 // Shader program ID. 142 // Shader program ID.
130 unsigned int shader_program_ = 0; 143 unsigned int shader_program_ = 0;
131 144
132 // Location of the scale value to be passed to the |shader_program_|. 145 // Location of the scale value to be passed to the |shader_program_|.
133 int shader_texcoord_scale_location_ = 0; 146 int shader_texcoord_scale_location_ = 0;
134 147
135 // True if the renderer has received frame from the host. 148 // True if the renderer has received frame from the host.
136 bool frame_received_ = false; 149 bool frame_received_ = false;
137 150
138 // True if dirty regions are to be sent to |event_handler_| for debugging. 151 // True if dirty regions are to be sent to |event_handler_| for debugging.
139 bool debug_dirty_region_ = false; 152 bool debug_dirty_region_ = false;
140 153
141 pp::CompletionCallbackFactory<PepperVideoRenderer3D> callback_factory_; 154 pp::CompletionCallbackFactory<PepperVideoRenderer3D> callback_factory_;
142 155
143 DISALLOW_COPY_AND_ASSIGN(PepperVideoRenderer3D); 156 DISALLOW_COPY_AND_ASSIGN(PepperVideoRenderer3D);
144 }; 157 };
145 158
146 } // namespace remoting 159 } // namespace remoting
147 160
148 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_ 161 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIDEO_RENDERER_3D_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/client/plugin/pepper_video_renderer_3d.cc » ('j') | remoting/client/plugin/pepper_video_renderer_3d.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698