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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 gl->DeleteTextures(3, source_textures); | 129 gl->DeleteTextures(3, source_textures); |
130 return skia::AdoptRef(img); | 130 return skia::AdoptRef(img); |
131 } | 131 } |
132 | 132 |
133 // Creates a SkImage from a |video_frame| backed by native resources. | 133 // Creates a SkImage from a |video_frame| backed by native resources. |
134 // The SkImage will take ownership of the underlying resource. | 134 // The SkImage will take ownership of the underlying resource. |
135 skia::RefPtr<SkImage> NewSkImageFromVideoFrameNative( | 135 skia::RefPtr<SkImage> NewSkImageFromVideoFrameNative( |
136 VideoFrame* video_frame, | 136 VideoFrame* video_frame, |
137 const Context3D& context_3d) { | 137 const Context3D& context_3d) { |
138 DCHECK(PIXEL_FORMAT_ARGB == video_frame->format() || | 138 DCHECK(PIXEL_FORMAT_ARGB == video_frame->format() || |
| 139 PIXEL_FORMAT_NV12 == video_frame->format() || |
139 PIXEL_FORMAT_UYVY == video_frame->format()); | 140 PIXEL_FORMAT_UYVY == video_frame->format()); |
140 | 141 |
141 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0); | 142 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0); |
142 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D || | 143 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D || |
143 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB || | 144 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB || |
144 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES) | 145 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES) |
145 << mailbox_holder.texture_target; | 146 << mailbox_holder.texture_target; |
146 | 147 |
147 gpu::gles2::GLES2Interface* gl = context_3d.gl; | 148 gpu::gles2::GLES2Interface* gl = context_3d.gl; |
148 unsigned source_texture = 0; | 149 unsigned source_texture = 0; |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 video_frame->UpdateReleaseSyncPoint(&client); | 570 video_frame->UpdateReleaseSyncPoint(&client); |
570 } | 571 } |
571 | 572 |
572 void SkCanvasVideoRenderer::ResetCache() { | 573 void SkCanvasVideoRenderer::ResetCache() { |
573 // Clear cached values. | 574 // Clear cached values. |
574 last_image_ = nullptr; | 575 last_image_ = nullptr; |
575 last_timestamp_ = kNoTimestamp(); | 576 last_timestamp_ = kNoTimestamp(); |
576 } | 577 } |
577 | 578 |
578 } // namespace media | 579 } // namespace media |
OLD | NEW |