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

Side by Side Diff: ppapi/proxy/video_decoder_resource.h

Issue 703753002: Pepper: Expose visible_rect to PPB_VideoDecoder.GetPicture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 6 years, 1 month 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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_ 5 #ifndef PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_
6 #define PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_ 6 #define PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "ppapi/proxy/connection.h" 14 #include "ppapi/proxy/connection.h"
15 #include "ppapi/proxy/plugin_resource.h" 15 #include "ppapi/proxy/plugin_resource.h"
16 #include "ppapi/proxy/ppapi_proxy_export.h" 16 #include "ppapi/proxy/ppapi_proxy_export.h"
17 #include "ppapi/shared_impl/resource.h" 17 #include "ppapi/shared_impl/resource.h"
18 #include "ppapi/shared_impl/scoped_pp_resource.h" 18 #include "ppapi/shared_impl/scoped_pp_resource.h"
19 #include "ppapi/thunk/ppb_video_decoder_api.h" 19 #include "ppapi/thunk/ppb_video_decoder_api.h"
20 20
21 struct PP_Rect;
22
21 namespace gpu { 23 namespace gpu {
22 struct Mailbox; 24 struct Mailbox;
23 namespace gles2 { 25 namespace gles2 {
24 class GLES2Implementation; 26 class GLES2Implementation;
25 } 27 }
26 } 28 }
27 29
28 namespace ppapi { 30 namespace ppapi {
29 31
30 class PPB_Graphics3D_Shared; 32 class PPB_Graphics3D_Shared;
(...skipping 18 matching lines...) Expand all
49 PP_Bool allow_software_fallback, 51 PP_Bool allow_software_fallback,
50 scoped_refptr<TrackedCallback> callback) override; 52 scoped_refptr<TrackedCallback> callback) override;
51 virtual int32_t Initialize(PP_Resource graphics_context, 53 virtual int32_t Initialize(PP_Resource graphics_context,
52 PP_VideoProfile profile, 54 PP_VideoProfile profile,
53 PP_HardwareAcceleration acceleration, 55 PP_HardwareAcceleration acceleration,
54 scoped_refptr<TrackedCallback> callback) override; 56 scoped_refptr<TrackedCallback> callback) override;
55 virtual int32_t Decode(uint32_t decode_id, 57 virtual int32_t Decode(uint32_t decode_id,
56 uint32_t size, 58 uint32_t size,
57 const void* buffer, 59 const void* buffer,
58 scoped_refptr<TrackedCallback> callback) override; 60 scoped_refptr<TrackedCallback> callback) override;
61 virtual int32_t GetPicture0_1(
62 PP_VideoPicture_0_1* picture,
63 scoped_refptr<TrackedCallback> callback) override;
59 virtual int32_t GetPicture(PP_VideoPicture* picture, 64 virtual int32_t GetPicture(PP_VideoPicture* picture,
60 scoped_refptr<TrackedCallback> callback) override; 65 scoped_refptr<TrackedCallback> callback) override;
61 virtual void RecyclePicture(const PP_VideoPicture* picture) override; 66 virtual void RecyclePicture(const PP_VideoPicture* picture) override;
62 virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) override; 67 virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) override;
63 virtual int32_t Reset(scoped_refptr<TrackedCallback> callback) override; 68 virtual int32_t Reset(scoped_refptr<TrackedCallback> callback) override;
64 69
65 // PluginResource implementation. 70 // PluginResource implementation.
66 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, 71 virtual void OnReplyReceived(const ResourceMessageReplyParams& params,
67 const IPC::Message& msg) override; 72 const IPC::Message& msg) override;
68 73
(...skipping 20 matching lines...) Expand all
89 struct Texture { 94 struct Texture {
90 Texture(uint32_t texture_target, const PP_Size& size); 95 Texture(uint32_t texture_target, const PP_Size& size);
91 ~Texture(); 96 ~Texture();
92 97
93 const uint32_t texture_target; 98 const uint32_t texture_target;
94 const PP_Size size; 99 const PP_Size size;
95 }; 100 };
96 101
97 // Struct to hold a picture received from the decoder. 102 // Struct to hold a picture received from the decoder.
98 struct Picture { 103 struct Picture {
99 Picture(int32_t decode_id, uint32_t texture_id); 104 Picture(int32_t decode_id,
105 uint32_t texture_id,
106 const PP_Rect& visible_rect);
100 ~Picture(); 107 ~Picture();
101 108
102 int32_t decode_id; 109 int32_t decode_id;
103 uint32_t texture_id; 110 uint32_t texture_id;
111 PP_Rect visible_rect;
104 }; 112 };
105 113
106 int32_t InitializeInternal(PP_Resource graphics_context,
107 PP_VideoProfile profile,
108 PP_Bool allow_software_fallback,
109 scoped_refptr<TrackedCallback> callback,
110 bool testing);
111
112 // Unsolicited reply message handlers. 114 // Unsolicited reply message handlers.
113 void OnPluginMsgRequestTextures(const ResourceMessageReplyParams& params, 115 void OnPluginMsgRequestTextures(const ResourceMessageReplyParams& params,
114 uint32_t num_textures, 116 uint32_t num_textures,
115 const PP_Size& size, 117 const PP_Size& size,
116 uint32_t texture_target, 118 uint32_t texture_target,
117 const std::vector<gpu::Mailbox>& mailboxes); 119 const std::vector<gpu::Mailbox>& mailboxes);
118 void OnPluginMsgPictureReady(const ResourceMessageReplyParams& params, 120 void OnPluginMsgPictureReady(const ResourceMessageReplyParams& params,
119 int32_t decode_id, 121 int32_t decode_id,
120 uint32_t texture_id); 122 uint32_t texture_id,
123 const PP_Rect& visible_rect);
121 void OnPluginMsgDismissPicture(const ResourceMessageReplyParams& params, 124 void OnPluginMsgDismissPicture(const ResourceMessageReplyParams& params,
122 uint32_t texture_id); 125 uint32_t texture_id);
123 void OnPluginMsgNotifyError(const ResourceMessageReplyParams& params, 126 void OnPluginMsgNotifyError(const ResourceMessageReplyParams& params,
124 int32_t error); 127 int32_t error);
125 128
126 // Reply message handlers for operations that are done in the host. 129 // Reply message handlers for operations that are done in the host.
127 void OnPluginMsgInitializeComplete(const ResourceMessageReplyParams& params); 130 void OnPluginMsgInitializeComplete(const ResourceMessageReplyParams& params);
128 void OnPluginMsgDecodeComplete(const ResourceMessageReplyParams& params, 131 void OnPluginMsgDecodeComplete(const ResourceMessageReplyParams& params,
129 uint32_t shm_id); 132 uint32_t shm_id);
130 void OnPluginMsgFlushComplete(const ResourceMessageReplyParams& params); 133 void OnPluginMsgFlushComplete(const ResourceMessageReplyParams& params);
131 void OnPluginMsgResetComplete(const ResourceMessageReplyParams& params); 134 void OnPluginMsgResetComplete(const ResourceMessageReplyParams& params);
132 135
133 void RunCallbackWithError(scoped_refptr<TrackedCallback>* callback); 136 void RunCallbackWithError(scoped_refptr<TrackedCallback>* callback);
134 void DeleteGLTexture(uint32_t texture_id); 137 void DeleteGLTexture(uint32_t texture_id);
135 void WriteNextPicture(PP_VideoPicture* picture); 138 void WriteNextPicture();
136 139
137 // ScopedVector to own the shared memory buffers. 140 // ScopedVector to own the shared memory buffers.
138 ScopedVector<ShmBuffer> shm_buffers_; 141 ScopedVector<ShmBuffer> shm_buffers_;
139 142
140 // List of available shared memory buffers. 143 // List of available shared memory buffers.
141 typedef std::vector<ShmBuffer*> ShmBufferList; 144 typedef std::vector<ShmBuffer*> ShmBufferList;
142 ShmBufferList available_shm_buffers_; 145 ShmBufferList available_shm_buffers_;
143 146
144 // Map of GL texture id to texture info. 147 // Map of GL texture id to texture info.
145 typedef base::hash_map<uint32_t, Texture> TextureMap; 148 typedef base::hash_map<uint32_t, Texture> TextureMap;
(...skipping 16 matching lines...) Expand all
162 // haven't received a picture from a Decode call after this many successive 165 // haven't received a picture from a Decode call after this many successive
163 // calls to Decode, then we will never receive a picture from the call. 166 // calls to Decode, then we will never receive a picture from the call.
164 // Note that this isn't guaranteed by H264 or other codecs. In practice, this 167 // Note that this isn't guaranteed by H264 or other codecs. In practice, this
165 // number is less than 16. Make it much larger just to be safe. 168 // number is less than 16. Make it much larger just to be safe.
166 // NOTE: because we count decodes mod 2^31, this value must be a power of 2. 169 // NOTE: because we count decodes mod 2^31, this value must be a power of 2.
167 static const int kMaximumPictureDelay = 128; 170 static const int kMaximumPictureDelay = 128;
168 uint32_t decode_ids_[kMaximumPictureDelay]; 171 uint32_t decode_ids_[kMaximumPictureDelay];
169 172
170 // State for pending get_picture_callback_. 173 // State for pending get_picture_callback_.
171 PP_VideoPicture* get_picture_; 174 PP_VideoPicture* get_picture_;
175 PP_VideoPicture_0_1* get_picture_0_1_;
172 176
173 ScopedPPResource graphics3d_; 177 ScopedPPResource graphics3d_;
174 gpu::gles2::GLES2Implementation* gles2_impl_; 178 gpu::gles2::GLES2Implementation* gles2_impl_;
175 179
176 bool initialized_; 180 bool initialized_;
177 bool testing_; 181 bool testing_;
178 int32_t decoder_last_error_; 182 int32_t decoder_last_error_;
179 183
180 DISALLOW_COPY_AND_ASSIGN(VideoDecoderResource); 184 DISALLOW_COPY_AND_ASSIGN(VideoDecoderResource);
181 }; 185 };
182 186
183 } // namespace proxy 187 } // namespace proxy
184 } // namespace ppapi 188 } // namespace ppapi
185 189
186 #endif // PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_ 190 #endif // PPAPI_PROXY_VIDEO_DECODER_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698