OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <string.h> | 5 #include <string.h> |
6 | 6 |
| 7 #include <iostream> |
| 8 #include <map> |
| 9 #include <set> |
| 10 #include <vector> |
| 11 |
7 #include "ppapi/c/dev/ppb_opengles_dev.h" | 12 #include "ppapi/c/dev/ppb_opengles_dev.h" |
8 #include "ppapi/c/pp_errors.h" | 13 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/cpp/dev/context_3d_dev.h" | 14 #include "ppapi/cpp/dev/context_3d_dev.h" |
10 #include "ppapi/cpp/dev/graphics_3d_client_dev.h" | 15 #include "ppapi/cpp/dev/graphics_3d_client_dev.h" |
11 #include "ppapi/cpp/dev/graphics_3d_dev.h" | 16 #include "ppapi/cpp/dev/graphics_3d_dev.h" |
12 #include "ppapi/cpp/dev/surface_3d_dev.h" | 17 #include "ppapi/cpp/dev/surface_3d_dev.h" |
13 #include "ppapi/cpp/dev/video_decoder_client_dev.h" | 18 #include "ppapi/cpp/dev/video_decoder_client_dev.h" |
14 #include "ppapi/cpp/dev/video_decoder_dev.h" | 19 #include "ppapi/cpp/dev/video_decoder_dev.h" |
15 #include "ppapi/cpp/instance.h" | 20 #include "ppapi/cpp/instance.h" |
16 #include "ppapi/cpp/module.h" | 21 #include "ppapi/cpp/module.h" |
17 #include "ppapi/cpp/rect.h" | 22 #include "ppapi/cpp/rect.h" |
18 #include "ppapi/examples/gles2/testdata.h" | 23 #include "ppapi/examples/gles2/testdata.h" |
19 #include "ppapi/lib/gl/include/GLES2/gl2.h" | 24 #include "ppapi/lib/gl/include/GLES2/gl2.h" |
20 | 25 |
21 // Prevent "unused variable" warnings when building in Release mode. | 26 // Use assert as a poor-man's CHECK, even in non-debug mode. |
22 #ifdef NDEBUG | 27 // Since <assert.h> redefines assert on every inclusion (it doesn't use |
23 #undef assert | 28 // include-guards), make sure this is the last file #include'd in this file. |
24 #define assert(expr) while (0 && (expr)) | 29 #undef NDEBUG |
25 #endif // NDEBUG | 30 #include <assert.h> |
26 | 31 |
27 namespace { | 32 namespace { |
28 | 33 |
29 class GLES2DemoInstance : public pp::Instance, public pp::Graphics3DClient_Dev, | 34 class GLES2DemoInstance : public pp::Instance, public pp::Graphics3DClient_Dev, |
30 public pp::VideoDecoderClient_Dev { | 35 public pp::VideoDecoderClient_Dev { |
31 public: | 36 public: |
32 GLES2DemoInstance(PP_Instance instance, pp::Module* module); | 37 GLES2DemoInstance(PP_Instance instance, pp::Module* module); |
33 virtual ~GLES2DemoInstance(); | 38 virtual ~GLES2DemoInstance(); |
34 | 39 |
35 // pp::Instance implementation (see PPP_Instance). | 40 // pp::Instance implementation (see PPP_Instance). |
(...skipping 15 matching lines...) Expand all Loading... |
51 PP_Size dimensions, PP_PictureBufferType_Dev type); | 56 PP_Size dimensions, PP_PictureBufferType_Dev type); |
52 virtual void DismissPictureBuffer( | 57 virtual void DismissPictureBuffer( |
53 pp::VideoDecoder_Dev decoder, int32_t picture_buffer_id); | 58 pp::VideoDecoder_Dev decoder, int32_t picture_buffer_id); |
54 virtual void PictureReady( | 59 virtual void PictureReady( |
55 pp::VideoDecoder_Dev decoder, const PP_Picture_Dev& picture); | 60 pp::VideoDecoder_Dev decoder, const PP_Picture_Dev& picture); |
56 virtual void EndOfStream(pp::VideoDecoder_Dev decoder); | 61 virtual void EndOfStream(pp::VideoDecoder_Dev decoder); |
57 virtual void NotifyError( | 62 virtual void NotifyError( |
58 pp::VideoDecoder_Dev decoder, PP_VideoDecodeError_Dev error); | 63 pp::VideoDecoder_Dev decoder, PP_VideoDecodeError_Dev error); |
59 | 64 |
60 private: | 65 private: |
| 66 enum { kNumConcurrentDecodes = 7 }; |
| 67 |
61 // Helper struct that stores data used by the shader program. | 68 // Helper struct that stores data used by the shader program. |
62 struct ShaderInfo { | 69 struct ShaderInfo { |
63 GLint pos_location; | 70 GLint pos_location; |
64 GLint tc_location; | 71 GLint tc_location; |
65 GLint tex_location; | 72 GLint tex_location; |
66 GLuint vertex_buffers[2]; | 73 GLuint vertex_buffers[2]; |
67 }; | 74 }; |
68 | 75 |
69 // Serialize PPB_Video_Decoder_Dev operations w.r.t. GPU command buffer. | 76 // Serialize PPB_Video_Decoder_Dev operations w.r.t. GPU command buffer. |
70 // TODO(fischman): figure out how much of this is actually necessary. | 77 // TODO(fischman): figure out how much of this is actually necessary. |
71 // Probably any necessary serialization ought to be happening in the | 78 // Probably any necessary serialization ought to be happening in the |
72 // PPAPI implementation, not in the plugin! | 79 // PPAPI implementation, not in the plugin! |
73 void FinishGL() { | 80 void FinishGL() { |
74 gles2_if_->Finish(context_->pp_resource()); | 81 gles2_if_->Finish(context_->pp_resource()); |
75 } | 82 } |
76 | 83 |
77 // Initialize Video Decoder. | 84 // Initialize Video Decoder. |
78 void InitializeDecoder(); | 85 void InitializeDecoder(); |
79 | 86 |
80 // Callbacks passed into pp:VideoDecoder_Dev functions. | 87 // Callbacks passed into pp:VideoDecoder_Dev functions. |
81 void DecoderInitDone(int32_t result); | 88 void DecoderInitDone(int32_t result); |
82 void DecoderBitstreamDone(int32_t result, int bitstream_buffer_id); | 89 void DecoderBitstreamDone(int32_t result, int bitstream_buffer_id); |
83 void DecoderFlushDone(int32_t result); | 90 void DecoderFlushDone(int32_t result); |
84 void DecoderAbortDone(int32_t result); | 91 void DecoderAbortDone(int32_t result); |
85 | 92 |
86 // Decode helpers. | 93 // Decode helpers. |
| 94 void DecodeNextNALUs(); |
87 void DecodeNextNALU(); | 95 void DecodeNextNALU(); |
88 void GetNextNALUBoundary(size_t start_pos, size_t* end_pos); | 96 void GetNextNALUBoundary(size_t start_pos, size_t* end_pos); |
89 void Render(const PP_GLESBuffer_Dev& buffer); | 97 void Render(const PP_GLESBuffer_Dev& buffer); |
90 | 98 |
91 // GL-related functions. | 99 // GL-related functions. |
92 void InitGL(); | 100 void InitGL(); |
93 GLuint CreateTexture(int32_t width, int32_t height); | 101 GLuint CreateTexture(int32_t width, int32_t height); |
94 void CreateGLObjects(); | 102 void CreateGLObjects(); |
95 void CreateShader(GLuint program, GLenum type, const char* source, int size); | 103 void CreateShader(GLuint program, GLenum type, const char* source, int size); |
96 void DeleteTexture(GLuint id); | 104 void DeleteTexture(GLuint id); |
97 void PaintFinished(int32_t result, int picture_buffer_id); | 105 void PaintFinished(int32_t result, int picture_buffer_id); |
98 | 106 |
99 // Assert |context_| isn't holding any GL Errors. | 107 // Assert |context_| isn't holding any GL Errors. |
100 void assertNoGLError() { | 108 void assertNoGLError() { |
101 assert(!gles2_if_->GetError(context_->pp_resource())); | 109 assert(!gles2_if_->GetError(context_->pp_resource())); |
102 } | 110 } |
103 | 111 |
104 pp::Size position_size_; | 112 pp::Size position_size_; |
105 ShaderInfo program_data_; | 113 ShaderInfo program_data_; |
106 int next_picture_buffer_id_; | 114 int next_picture_buffer_id_; |
107 int next_bitstream_buffer_id_; | 115 int next_bitstream_buffer_id_; |
108 bool is_painting_; | 116 bool is_painting_; |
109 pp::CompletionCallbackFactory<GLES2DemoInstance> callback_factory_; | 117 pp::CompletionCallbackFactory<GLES2DemoInstance> callback_factory_; |
110 size_t encoded_data_next_pos_to_decode_; | 118 size_t encoded_data_next_pos_to_decode_; |
| 119 std::set<int> bitstream_ids_at_decoder_; |
111 | 120 |
112 // Map of texture buffers indexed by buffer id. | 121 // Map of texture buffers indexed by buffer id. |
113 typedef std::map<int, PP_GLESBuffer_Dev> PictureBufferMap; | 122 typedef std::map<int, PP_GLESBuffer_Dev> PictureBufferMap; |
114 PictureBufferMap buffers_by_id_; | 123 PictureBufferMap buffers_by_id_; |
115 // Map of bitstream buffers indexed by id. | 124 // Map of bitstream buffers indexed by id. |
116 typedef std::map<int, pp::Buffer_Dev*> BitstreamBufferMap; | 125 typedef std::map<int, pp::Buffer_Dev*> BitstreamBufferMap; |
117 BitstreamBufferMap bitstream_buffers_by_id_; | 126 BitstreamBufferMap bitstream_buffers_by_id_; |
118 | 127 |
119 // Unowned pointers. | 128 // Unowned pointers. |
120 const struct PPB_OpenGLES2_Dev* gles2_if_; | 129 const struct PPB_OpenGLES2_Dev* gles2_if_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 return; | 175 return; |
167 video_decoder_ = new pp::VideoDecoder_Dev(*this); | 176 video_decoder_ = new pp::VideoDecoder_Dev(*this); |
168 | 177 |
169 PP_VideoConfigElement configs = PP_VIDEOATTR_DICTIONARY_TERMINATOR; | 178 PP_VideoConfigElement configs = PP_VIDEOATTR_DICTIONARY_TERMINATOR; |
170 pp::CompletionCallback cb = | 179 pp::CompletionCallback cb = |
171 callback_factory_.NewCallback(&GLES2DemoInstance::DecoderInitDone); | 180 callback_factory_.NewCallback(&GLES2DemoInstance::DecoderInitDone); |
172 video_decoder_->Initialize(&configs, *context_, cb); | 181 video_decoder_->Initialize(&configs, *context_, cb); |
173 } | 182 } |
174 | 183 |
175 void GLES2DemoInstance::DecoderInitDone(int32_t result) { | 184 void GLES2DemoInstance::DecoderInitDone(int32_t result) { |
176 DecodeNextNALU(); | 185 DecodeNextNALUs(); |
177 } | 186 } |
178 | 187 |
179 void GLES2DemoInstance::DecoderBitstreamDone( | 188 void GLES2DemoInstance::DecoderBitstreamDone( |
180 int32_t result, int bitstream_buffer_id) { | 189 int32_t result, int bitstream_buffer_id) { |
| 190 assert(bitstream_ids_at_decoder_.erase(bitstream_buffer_id) == 1); |
181 BitstreamBufferMap::iterator it = | 191 BitstreamBufferMap::iterator it = |
182 bitstream_buffers_by_id_.find(bitstream_buffer_id); | 192 bitstream_buffers_by_id_.find(bitstream_buffer_id); |
183 assert(it != bitstream_buffers_by_id_.end()); | 193 assert(it != bitstream_buffers_by_id_.end()); |
184 delete it->second; | 194 delete it->second; |
185 DecodeNextNALU(); | 195 DecodeNextNALUs(); |
186 } | 196 } |
187 | 197 |
188 void GLES2DemoInstance::DecoderFlushDone(int32_t result) { | 198 void GLES2DemoInstance::DecoderFlushDone(int32_t result) { |
| 199 // Check that each bitstream buffer ID we handed to the decoder got handed |
| 200 // back to us. |
| 201 assert(bitstream_ids_at_decoder_.empty()); |
189 } | 202 } |
190 | 203 |
191 void GLES2DemoInstance::DecoderAbortDone(int32_t result) { | 204 void GLES2DemoInstance::DecoderAbortDone(int32_t result) { |
192 } | 205 } |
193 | 206 |
194 static bool LookingAtNAL(const unsigned char* encoded, size_t pos) { | 207 static bool LookingAtNAL(const unsigned char* encoded, size_t pos) { |
195 return pos + 3 < kDataLen && | 208 return pos + 3 < kDataLen && |
196 encoded[pos] == 0 && encoded[pos + 1] == 0 && | 209 encoded[pos] == 0 && encoded[pos + 1] == 0 && |
197 encoded[pos + 2] == 0 && encoded[pos + 3] == 1; | 210 encoded[pos + 2] == 0 && encoded[pos + 3] == 1; |
198 } | 211 } |
199 | 212 |
200 void GLES2DemoInstance::GetNextNALUBoundary( | 213 void GLES2DemoInstance::GetNextNALUBoundary( |
201 size_t start_pos, size_t* end_pos) { | 214 size_t start_pos, size_t* end_pos) { |
202 assert(LookingAtNAL(kData, start_pos)); | 215 assert(LookingAtNAL(kData, start_pos)); |
203 *end_pos = start_pos; | 216 *end_pos = start_pos; |
204 *end_pos += 4; | 217 *end_pos += 4; |
205 while (*end_pos + 3 < kDataLen && | 218 while (*end_pos + 3 < kDataLen && |
206 !LookingAtNAL(kData, *end_pos)) { | 219 !LookingAtNAL(kData, *end_pos)) { |
207 ++*end_pos; | 220 ++*end_pos; |
208 } | 221 } |
209 if (*end_pos + 3 >= kDataLen) { | 222 if (*end_pos + 3 >= kDataLen) { |
210 *end_pos = kDataLen; | 223 *end_pos = kDataLen; |
211 return; | 224 return; |
212 } | 225 } |
213 } | 226 } |
214 | 227 |
| 228 void GLES2DemoInstance::DecodeNextNALUs() { |
| 229 while (encoded_data_next_pos_to_decode_ <= kDataLen && |
| 230 bitstream_ids_at_decoder_.size() < kNumConcurrentDecodes) { |
| 231 DecodeNextNALU(); |
| 232 } |
| 233 } |
| 234 |
215 void GLES2DemoInstance::DecodeNextNALU() { | 235 void GLES2DemoInstance::DecodeNextNALU() { |
216 if (encoded_data_next_pos_to_decode_ == kDataLen) { | 236 if (encoded_data_next_pos_to_decode_ == kDataLen) { |
| 237 ++encoded_data_next_pos_to_decode_; |
217 pp::CompletionCallback cb = | 238 pp::CompletionCallback cb = |
218 callback_factory_.NewCallback(&GLES2DemoInstance::DecoderFlushDone); | 239 callback_factory_.NewCallback(&GLES2DemoInstance::DecoderFlushDone); |
219 video_decoder_->Flush(cb); | 240 video_decoder_->Flush(cb); |
220 return; | 241 return; |
221 } | 242 } |
222 size_t start_pos = encoded_data_next_pos_to_decode_; | 243 size_t start_pos = encoded_data_next_pos_to_decode_; |
223 size_t end_pos; | 244 size_t end_pos; |
224 GetNextNALUBoundary(start_pos, &end_pos); | 245 GetNextNALUBoundary(start_pos, &end_pos); |
225 pp::Buffer_Dev* buffer = new pp::Buffer_Dev (this, end_pos - start_pos); | 246 pp::Buffer_Dev* buffer = new pp::Buffer_Dev (this, end_pos - start_pos); |
226 PP_VideoBitstreamBuffer_Dev bitstream_buffer; | 247 PP_VideoBitstreamBuffer_Dev bitstream_buffer; |
227 int id = ++next_bitstream_buffer_id_; | 248 int id = ++next_bitstream_buffer_id_; |
228 bitstream_buffer.id = id; | 249 bitstream_buffer.id = id; |
229 bitstream_buffer.size = end_pos - start_pos; | 250 bitstream_buffer.size = end_pos - start_pos; |
230 bitstream_buffer.data = buffer->pp_resource(); | 251 bitstream_buffer.data = buffer->pp_resource(); |
231 memcpy(buffer->data(), kData + start_pos, end_pos - start_pos); | 252 memcpy(buffer->data(), kData + start_pos, end_pos - start_pos); |
232 bool result = | 253 assert(bitstream_buffers_by_id_.insert(std::make_pair(id, buffer)).second); |
233 bitstream_buffers_by_id_.insert(std::make_pair(id, buffer)).second; | |
234 assert(result); | |
235 | 254 |
236 pp::CompletionCallback cb = | 255 pp::CompletionCallback cb = |
237 callback_factory_.NewCallback( | 256 callback_factory_.NewCallback( |
238 &GLES2DemoInstance::DecoderBitstreamDone, id); | 257 &GLES2DemoInstance::DecoderBitstreamDone, id); |
| 258 assert(bitstream_ids_at_decoder_.insert(id).second); |
239 video_decoder_->Decode(bitstream_buffer, cb); | 259 video_decoder_->Decode(bitstream_buffer, cb); |
240 encoded_data_next_pos_to_decode_ = end_pos; | 260 encoded_data_next_pos_to_decode_ = end_pos; |
241 } | 261 } |
242 | 262 |
243 void GLES2DemoInstance::ProvidePictureBuffers( | 263 void GLES2DemoInstance::ProvidePictureBuffers( |
244 pp::VideoDecoder_Dev decoder, uint32_t req_num_of_bufs, PP_Size dimensions, | 264 pp::VideoDecoder_Dev decoder, uint32_t req_num_of_bufs, PP_Size dimensions, |
245 PP_PictureBufferType_Dev type) { | 265 PP_PictureBufferType_Dev type) { |
246 std::vector<PP_GLESBuffer_Dev> buffers; | 266 std::vector<PP_GLESBuffer_Dev> buffers; |
247 for (uint32_t i = 0; i < req_num_of_bufs; i++) { | 267 for (uint32_t i = 0; i < req_num_of_bufs; i++) { |
248 PP_GLESBuffer_Dev buffer; | 268 PP_GLESBuffer_Dev buffer; |
249 buffer.texture_id = CreateTexture(dimensions.width, dimensions.height); | 269 buffer.texture_id = CreateTexture(dimensions.width, dimensions.height); |
250 int id = ++next_picture_buffer_id_; | 270 int id = ++next_picture_buffer_id_; |
251 buffer.info.id= id; | 271 buffer.info.id= id; |
252 buffers.push_back(buffer); | 272 buffers.push_back(buffer); |
253 bool result = buffers_by_id_.insert(std::make_pair(id, buffer)).second; | 273 assert(buffers_by_id_.insert(std::make_pair(id, buffer)).second); |
254 assert(result); | |
255 } | 274 } |
256 FinishGL(); | 275 FinishGL(); |
257 video_decoder_->AssignGLESBuffers(buffers); | 276 video_decoder_->AssignGLESBuffers(buffers); |
258 } | 277 } |
259 | 278 |
260 void GLES2DemoInstance::DismissPictureBuffer( | 279 void GLES2DemoInstance::DismissPictureBuffer( |
261 pp::VideoDecoder_Dev decoder, int32_t picture_buffer_id) { | 280 pp::VideoDecoder_Dev decoder, int32_t picture_buffer_id) { |
262 PictureBufferMap::iterator it = buffers_by_id_.find(picture_buffer_id); | 281 PictureBufferMap::iterator it = buffers_by_id_.find(picture_buffer_id); |
263 assert(it != buffers_by_id_.end()); | 282 assert(it != buffers_by_id_.end()); |
264 DeleteTexture(it->second.texture_id); | 283 DeleteTexture(it->second.texture_id); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 assert(!context_->is_null()); | 322 assert(!context_->is_null()); |
304 | 323 |
305 int32_t surface_attributes[] = { | 324 int32_t surface_attributes[] = { |
306 PP_GRAPHICS3DATTRIB_WIDTH, position_size_.width(), | 325 PP_GRAPHICS3DATTRIB_WIDTH, position_size_.width(), |
307 PP_GRAPHICS3DATTRIB_HEIGHT, position_size_.height(), | 326 PP_GRAPHICS3DATTRIB_HEIGHT, position_size_.height(), |
308 PP_GRAPHICS3DATTRIB_NONE | 327 PP_GRAPHICS3DATTRIB_NONE |
309 }; | 328 }; |
310 surface_ = new pp::Surface3D_Dev(*this, 0, surface_attributes); | 329 surface_ = new pp::Surface3D_Dev(*this, 0, surface_attributes); |
311 assert(!surface_->is_null()); | 330 assert(!surface_->is_null()); |
312 | 331 |
313 int32_t bind_error = context_->BindSurfaces(*surface_, *surface_); | 332 assert(!context_->BindSurfaces(*surface_, *surface_)); |
314 assert(!bind_error); | |
315 | 333 |
316 // Set viewport window size and clear color bit. | 334 // Set viewport window size and clear color bit. |
317 gles2_if_->Clear(context_->pp_resource(), GL_COLOR_BUFFER_BIT); | 335 gles2_if_->Clear(context_->pp_resource(), GL_COLOR_BUFFER_BIT); |
318 gles2_if_->Viewport(context_->pp_resource(), 0, 0, | 336 gles2_if_->Viewport(context_->pp_resource(), 0, 0, |
319 position_size_.width(), position_size_.height()); | 337 position_size_.width(), position_size_.height()); |
320 | 338 |
321 bool success = BindGraphics(*surface_); | 339 assert(BindGraphics(*surface_)); |
322 assert(success); | |
323 assertNoGLError(); | 340 assertNoGLError(); |
324 | 341 |
325 CreateGLObjects(); | 342 CreateGLObjects(); |
326 | 343 |
327 FinishGL(); | 344 FinishGL(); |
328 } | 345 } |
329 | 346 |
330 void GLES2DemoInstance::Render(const PP_GLESBuffer_Dev& buffer) { | 347 void GLES2DemoInstance::Render(const PP_GLESBuffer_Dev& buffer) { |
331 if (is_painting_) { | 348 if (is_painting_) { |
332 // We are dropping frames if we don't render fast enough - | 349 // We are dropping frames if we don't render fast enough - |
333 // that is why sometimes the last frame rendered is < 249. | 350 // that is why sometimes the last frame rendered is < 249. |
334 if (video_decoder_) { | 351 if (video_decoder_) { |
335 FinishGL(); | 352 FinishGL(); |
336 video_decoder_->ReusePictureBuffer(buffer.info.id); | 353 video_decoder_->ReusePictureBuffer(buffer.info.id); |
337 } | 354 } |
338 return; | 355 return; |
339 } | 356 } |
340 is_painting_ = true; | 357 is_painting_ = true; |
341 gles2_if_->ActiveTexture(context_->pp_resource(), GL_TEXTURE0); | 358 gles2_if_->ActiveTexture(context_->pp_resource(), GL_TEXTURE0); |
342 gles2_if_->BindTexture( | 359 gles2_if_->BindTexture( |
343 context_->pp_resource(), GL_TEXTURE_2D, buffer.texture_id); | 360 context_->pp_resource(), GL_TEXTURE_2D, buffer.texture_id); |
344 gles2_if_->Uniform1i(context_->pp_resource(), program_data_.tex_location, 0); | 361 gles2_if_->Uniform1i(context_->pp_resource(), program_data_.tex_location, 0); |
345 gles2_if_->DrawArrays(context_->pp_resource(), GL_TRIANGLE_STRIP, 0, 4); | 362 gles2_if_->DrawArrays(context_->pp_resource(), GL_TRIANGLE_STRIP, 0, 4); |
346 pp::CompletionCallback cb = | 363 pp::CompletionCallback cb = |
347 callback_factory_.NewCallback( | 364 callback_factory_.NewCallback( |
348 &GLES2DemoInstance::PaintFinished, buffer.info.id); | 365 &GLES2DemoInstance::PaintFinished, buffer.info.id); |
349 int32_t error = surface_->SwapBuffers(cb); | 366 assert(surface_->SwapBuffers(cb) == PP_ERROR_WOULDBLOCK); |
350 assert(error == PP_ERROR_WOULDBLOCK); | |
351 assertNoGLError(); | 367 assertNoGLError(); |
352 } | 368 } |
353 | 369 |
354 void GLES2DemoInstance::PaintFinished(int32_t result, int picture_buffer_id) { | 370 void GLES2DemoInstance::PaintFinished(int32_t result, int picture_buffer_id) { |
355 is_painting_ = false; | 371 is_painting_ = false; |
356 FinishGL(); | 372 FinishGL(); |
357 if (video_decoder_) | 373 if (video_decoder_) |
358 video_decoder_->ReusePictureBuffer(picture_buffer_id); | 374 video_decoder_->ReusePictureBuffer(picture_buffer_id); |
359 } | 375 } |
360 | 376 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 gles2_if_->DeleteShader(context_->pp_resource(), shader); | 507 gles2_if_->DeleteShader(context_->pp_resource(), shader); |
492 } | 508 } |
493 } // anonymous namespace | 509 } // anonymous namespace |
494 | 510 |
495 namespace pp { | 511 namespace pp { |
496 // Factory function for your specialization of the Module object. | 512 // Factory function for your specialization of the Module object. |
497 Module* CreateModule() { | 513 Module* CreateModule() { |
498 return new GLES2DemoModule(); | 514 return new GLES2DemoModule(); |
499 } | 515 } |
500 } // namespace pp | 516 } // namespace pp |
OLD | NEW |