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

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

Issue 2126053002: Avoid copying NV12 GL_TEXTURE_EXTERNAL_OES textures for use with skia. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderers/skcanvas_video_renderer.h" 5 #include "media/renderers/skcanvas_video_renderer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(i); 102 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(i);
103 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D || 103 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D ||
104 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES || 104 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES ||
105 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB); 105 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB);
106 gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData()); 106 gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData());
107 source_textures[i].fID = gl->CreateAndConsumeTextureCHROMIUM( 107 source_textures[i].fID = gl->CreateAndConsumeTextureCHROMIUM(
108 mailbox_holder.texture_target, mailbox_holder.mailbox.name); 108 mailbox_holder.texture_target, mailbox_holder.mailbox.name);
109 source_textures[i].fTarget = mailbox_holder.texture_target; 109 source_textures[i].fTarget = mailbox_holder.texture_target;
110 110
111 // TODO(dcastagna): avoid this copy once Skia supports native textures 111 // TODO(dcastagna): avoid this copy once Skia supports native textures
112 // with a texture target different than TEXTURE_2D. 112 // with a GL_TEXTURE_RECTANGLE_ARB texture target.
113 // crbug.com/505026 113 // crbug.com/505026
114 if (mailbox_holder.texture_target != GL_TEXTURE_2D) { 114 if (mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB) {
115 unsigned texture_copy = 0; 115 unsigned texture_copy = 0;
116 gl->GenTextures(1, &texture_copy); 116 gl->GenTextures(1, &texture_copy);
117 DCHECK(texture_copy); 117 DCHECK(texture_copy);
118 gl->BindTexture(GL_TEXTURE_2D, texture_copy); 118 gl->BindTexture(GL_TEXTURE_2D, texture_copy);
119 gl->CopyTextureCHROMIUM(source_textures[i].fID, texture_copy, GL_RGB, 119 gl->CopyTextureCHROMIUM(source_textures[i].fID, texture_copy, GL_RGB,
120 GL_UNSIGNED_BYTE, false, true, false); 120 GL_UNSIGNED_BYTE, false, true, false);
121 121
122 gl->DeleteTextures(1, &source_textures[i].fID); 122 gl->DeleteTextures(1, &source_textures[i].fID);
123 source_textures[i].fID = texture_copy; 123 source_textures[i].fID = texture_copy;
124 source_textures[i].fTarget = GL_TEXTURE_2D; 124 source_textures[i].fTarget = GL_TEXTURE_2D;
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 679 }
680 680
681 void SkCanvasVideoRenderer::ResetCache() { 681 void SkCanvasVideoRenderer::ResetCache() {
682 DCHECK(thread_checker_.CalledOnValidThread()); 682 DCHECK(thread_checker_.CalledOnValidThread());
683 // Clear cached values. 683 // Clear cached values.
684 last_image_ = nullptr; 684 last_image_ = nullptr;
685 last_timestamp_ = kNoTimestamp(); 685 last_timestamp_ = kNoTimestamp();
686 } 686 }
687 687
688 } // namespace media 688 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698