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

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

Issue 1307853003: Add support for converting I420 software frames into NV12 hardware frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@biplanar
Patch Set: Created 5 years, 3 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 gl->DeleteTextures(3, source_textures); 126 gl->DeleteTextures(3, source_textures);
127 return skia::AdoptRef(img); 127 return skia::AdoptRef(img);
128 } 128 }
129 129
130 // Creates a SkImage from a |video_frame| backed by native resources. 130 // Creates a SkImage from a |video_frame| backed by native resources.
131 // The SkImage will take ownership of the underlying resource. 131 // The SkImage will take ownership of the underlying resource.
132 skia::RefPtr<SkImage> NewSkImageFromVideoFrameNative( 132 skia::RefPtr<SkImage> NewSkImageFromVideoFrameNative(
133 VideoFrame* video_frame, 133 VideoFrame* video_frame,
134 const Context3D& context_3d) { 134 const Context3D& context_3d) {
135 DCHECK(PIXEL_FORMAT_ARGB == video_frame->format() || 135 DCHECK(PIXEL_FORMAT_ARGB == video_frame->format() ||
136 PIXEL_FORMAT_NV12 == video_frame->format() ||
136 PIXEL_FORMAT_UYVY == video_frame->format()); 137 PIXEL_FORMAT_UYVY == video_frame->format());
137 138
138 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0); 139 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0);
139 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D || 140 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D ||
140 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB || 141 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB ||
141 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES) 142 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES)
142 << mailbox_holder.texture_target; 143 << mailbox_holder.texture_target;
143 144
144 gpu::gles2::GLES2Interface* gl = context_3d.gl; 145 gpu::gles2::GLES2Interface* gl = context_3d.gl;
145 unsigned source_texture = 0; 146 unsigned source_texture = 0;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 video_frame->UpdateReleaseSyncPoint(&client); 586 video_frame->UpdateReleaseSyncPoint(&client);
586 } 587 }
587 588
588 void SkCanvasVideoRenderer::ResetCache() { 589 void SkCanvasVideoRenderer::ResetCache() {
589 // Clear cached values. 590 // Clear cached values.
590 last_image_ = nullptr; 591 last_image_ = nullptr;
591 last_timestamp_ = kNoTimestamp(); 592 last_timestamp_ = kNoTimestamp();
592 } 593 }
593 594
594 } // namespace media 595 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698