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 #include "ppapi/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
6 #include "ppapi/c/ppb_opengles2.h" | 6 #include "ppapi/c/ppb_opengles2.h" |
7 #include "ppapi/cpp/completion_callback.h" | 7 #include "ppapi/cpp/completion_callback.h" |
8 #include "ppapi/cpp/dev/var_resource_dev.h" | 8 #include "ppapi/cpp/dev/var_resource_dev.h" |
9 #include "ppapi/cpp/graphics_3d.h" | 9 #include "ppapi/cpp/graphics_3d.h" |
10 #include "ppapi/cpp/graphics_3d_client.h" | 10 #include "ppapi/cpp/graphics_3d_client.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 texture_u_ = CreateTexture(width, height, 1); | 335 texture_u_ = CreateTexture(width, height, 1); |
336 texture_v_ = CreateTexture(width, height, 2); | 336 texture_v_ = CreateTexture(width, height, 2); |
337 } | 337 } |
338 | 338 |
339 void MediaStreamVideoDemoInstance::OnGetFrame( | 339 void MediaStreamVideoDemoInstance::OnGetFrame( |
340 int32_t result, pp::VideoFrame frame) { | 340 int32_t result, pp::VideoFrame frame) { |
341 if (result != PP_OK) | 341 if (result != PP_OK) |
342 return; | 342 return; |
343 const char* data = static_cast<const char*>(frame.GetDataBuffer()); | 343 const char* data = static_cast<const char*>(frame.GetDataBuffer()); |
344 pp::Size size; | 344 pp::Size size; |
345 PP_DCHECK(frame.GetSize(&size)); | 345 frame.GetSize(&size); |
346 | 346 |
347 if (size != frame_size_) { | 347 if (size != frame_size_) { |
348 frame_size_ = size; | 348 frame_size_ = size; |
349 CreateYUVTextures(); | 349 CreateYUVTextures(); |
350 } | 350 } |
351 | 351 |
352 int32_t width = frame_size_.width(); | 352 int32_t width = frame_size_.width(); |
353 int32_t height = frame_size_.height(); | 353 int32_t height = frame_size_.height(); |
354 gles2_if_->ActiveTexture(context_->pp_resource(), GL_TEXTURE0); | 354 gles2_if_->ActiveTexture(context_->pp_resource(), GL_TEXTURE0); |
355 gles2_if_->TexSubImage2D( | 355 gles2_if_->TexSubImage2D( |
(...skipping 30 matching lines...) Expand all Loading... |
386 } | 386 } |
387 | 387 |
388 } // anonymous namespace | 388 } // anonymous namespace |
389 | 389 |
390 namespace pp { | 390 namespace pp { |
391 // Factory function for your specialization of the Module object. | 391 // Factory function for your specialization of the Module object. |
392 Module* CreateModule() { | 392 Module* CreateModule() { |
393 return new MediaStreamVideoModule(); | 393 return new MediaStreamVideoModule(); |
394 } | 394 } |
395 } // namespace pp | 395 } // namespace pp |
OLD | NEW |