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

Side by Side Diff: media/blink/skcanvas_video_renderer.cc

Issue 1117423002: media: Let VideoFrame carry more than one native texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reveman's comments. Created 5 years, 7 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 (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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 // static 600 // static
601 void SkCanvasVideoRenderer::CopyVideoFrameTextureToGLTexture( 601 void SkCanvasVideoRenderer::CopyVideoFrameTextureToGLTexture(
602 gpu::gles2::GLES2Interface* gl, 602 gpu::gles2::GLES2Interface* gl,
603 VideoFrame* video_frame, 603 VideoFrame* video_frame,
604 unsigned int texture, 604 unsigned int texture,
605 unsigned int internal_format, 605 unsigned int internal_format,
606 unsigned int type, 606 unsigned int type,
607 bool premultiply_alpha, 607 bool premultiply_alpha,
608 bool flip_y) { 608 bool flip_y) {
609 DCHECK(video_frame && video_frame->format() == VideoFrame::NATIVE_TEXTURE); 609 DCHECK(video_frame && video_frame->format() == VideoFrame::NATIVE_TEXTURE);
610 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); 610 DCHECK_EQ(1u, VideoFrame::NumTextures(video_frame->texture_format()));
611 DCHECK(mailbox_holder->texture_target == GL_TEXTURE_2D || 611 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0);
612 mailbox_holder->texture_target == GL_TEXTURE_RECTANGLE_ARB || 612 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D ||
613 mailbox_holder->texture_target == GL_TEXTURE_EXTERNAL_OES); 613 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB ||
614 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES);
614 615
615 gl->WaitSyncPointCHROMIUM(mailbox_holder->sync_point); 616 gl->WaitSyncPointCHROMIUM(mailbox_holder.sync_point);
616 uint32 source_texture = gl->CreateAndConsumeTextureCHROMIUM( 617 uint32 source_texture = gl->CreateAndConsumeTextureCHROMIUM(
617 mailbox_holder->texture_target, mailbox_holder->mailbox.name); 618 mailbox_holder.texture_target, mailbox_holder.mailbox.name);
618 619
619 // The video is stored in a unmultiplied format, so premultiply 620 // The video is stored in a unmultiplied format, so premultiply
620 // if necessary. 621 // if necessary.
621 gl->PixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, premultiply_alpha); 622 gl->PixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, premultiply_alpha);
622 // Application itself needs to take care of setting the right |flip_y| 623 // Application itself needs to take care of setting the right |flip_y|
623 // value down to get the expected result. 624 // value down to get the expected result.
624 // "flip_y == true" means to reverse the video orientation while 625 // "flip_y == true" means to reverse the video orientation while
625 // "flip_y == false" means to keep the intrinsic orientation. 626 // "flip_y == false" means to keep the intrinsic orientation.
626 gl->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); 627 gl->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y);
627 gl->CopyTextureCHROMIUM(GL_TEXTURE_2D, source_texture, texture, 628 gl->CopyTextureCHROMIUM(GL_TEXTURE_2D, source_texture, texture,
(...skipping 13 matching lines...) Expand all
641 last_frame_timestamp_ = media::kNoTimestamp(); 642 last_frame_timestamp_ = media::kNoTimestamp();
642 } 643 }
643 644
644 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() { 645 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() {
645 accelerated_last_frame_.reset(); 646 accelerated_last_frame_.reset();
646 accelerated_generator_ = nullptr; 647 accelerated_generator_ = nullptr;
647 accelerated_last_frame_timestamp_ = media::kNoTimestamp(); 648 accelerated_last_frame_timestamp_ = media::kNoTimestamp();
648 } 649 }
649 650
650 } // namespace media 651 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698