OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/blink/skcanvas_video_renderer.h" | 5 #include "media/blink/skcanvas_video_renderer.h" |
6 | 6 |
7 #include "gpu/GLES2/gl2extchromium.h" | 7 #include "gpu/GLES2/gl2extchromium.h" |
8 #include "gpu/command_buffer/client/gles2_interface.h" | 8 #include "gpu/command_buffer/client/gles2_interface.h" |
9 #include "gpu/command_buffer/common/mailbox_holder.h" | 9 #include "gpu/command_buffer/common/mailbox_holder.h" |
10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D || | 630 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D || |
631 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB || | 631 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB || |
632 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES); | 632 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES); |
633 | 633 |
634 gl->WaitSyncPointCHROMIUM(mailbox_holder.sync_point); | 634 gl->WaitSyncPointCHROMIUM(mailbox_holder.sync_point); |
635 uint32 source_texture = gl->CreateAndConsumeTextureCHROMIUM( | 635 uint32 source_texture = gl->CreateAndConsumeTextureCHROMIUM( |
636 mailbox_holder.texture_target, mailbox_holder.mailbox.name); | 636 mailbox_holder.texture_target, mailbox_holder.mailbox.name); |
637 | 637 |
638 // The video is stored in a unmultiplied format, so premultiply | 638 // The video is stored in a unmultiplied format, so premultiply |
639 // if necessary. | 639 // if necessary. |
640 gl->PixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, premultiply_alpha); | |
641 // Application itself needs to take care of setting the right |flip_y| | 640 // Application itself needs to take care of setting the right |flip_y| |
642 // value down to get the expected result. | 641 // value down to get the expected result. |
643 // "flip_y == true" means to reverse the video orientation while | 642 // "flip_y == true" means to reverse the video orientation while |
644 // "flip_y == false" means to keep the intrinsic orientation. | 643 // "flip_y == false" means to keep the intrinsic orientation. |
645 gl->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); | |
646 gl->CopyTextureCHROMIUM(GL_TEXTURE_2D, source_texture, texture, | 644 gl->CopyTextureCHROMIUM(GL_TEXTURE_2D, source_texture, texture, |
647 internal_format, type, | 645 internal_format, type, |
648 flip_y, premultiply_alpha, false); | 646 flip_y, premultiply_alpha, false); |
649 gl->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); | |
650 gl->PixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); | |
651 | 647 |
652 gl->DeleteTextures(1, &source_texture); | 648 gl->DeleteTextures(1, &source_texture); |
653 gl->Flush(); | 649 gl->Flush(); |
654 | 650 |
655 SyncPointClientImpl client(gl); | 651 SyncPointClientImpl client(gl); |
656 video_frame->UpdateReleaseSyncPoint(&client); | 652 video_frame->UpdateReleaseSyncPoint(&client); |
657 } | 653 } |
658 | 654 |
659 void SkCanvasVideoRenderer::ResetLastFrame() { | 655 void SkCanvasVideoRenderer::ResetLastFrame() { |
660 last_frame_.reset(); | 656 last_frame_.reset(); |
661 last_frame_timestamp_ = media::kNoTimestamp(); | 657 last_frame_timestamp_ = media::kNoTimestamp(); |
662 } | 658 } |
663 | 659 |
664 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() { | 660 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() { |
665 accelerated_last_image_.reset(); | 661 accelerated_last_image_.reset(); |
666 accelerated_last_frame_.reset(); | 662 accelerated_last_frame_.reset(); |
667 accelerated_generator_ = nullptr; | 663 accelerated_generator_ = nullptr; |
668 accelerated_last_frame_timestamp_ = media::kNoTimestamp(); | 664 accelerated_last_frame_timestamp_ = media::kNoTimestamp(); |
669 } | 665 } |
670 | 666 |
671 } // namespace media | 667 } // namespace media |
OLD | NEW |