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

Unified Diff: media/renderers/skcanvas_video_renderer.h

Issue 2127053004: Optimize webgl texImage2D from YUV video textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@skianocopy
Patch Set: hold on to converted SkImages 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 side-by-side diff with in-line comments
Download patch
Index: media/renderers/skcanvas_video_renderer.h
diff --git a/media/renderers/skcanvas_video_renderer.h b/media/renderers/skcanvas_video_renderer.h
index 9c6d23c7481760ad7a309dac44adfe605c1b073c..02039405f0f2bc26d33a9b70d07b0a99bc8ad094 100644
--- a/media/renderers/skcanvas_video_renderer.h
+++ b/media/renderers/skcanvas_video_renderer.h
@@ -78,6 +78,22 @@ class MEDIA_EXPORT SkCanvasVideoRenderer {
bool premultiply_alpha,
bool flip_y);
+ // Copy the contents of texture of |video_frame| to texture |texture| in
+ // context |destination_gl|.
+ // |level|, |internal_format|, |type| specify target texture |texture|.
+ // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE.
+ // |context_3d| has a GrContext that may be used during the copy.
+ // Returns true on success.
+ bool CopyVideoFrameTexturesToGLTexture(
+ const Context3D& context_3d,
+ gpu::gles2::GLES2Interface* destination_gl,
+ const scoped_refptr<VideoFrame>& video_frame,
+ unsigned int texture,
+ unsigned int internal_format,
+ unsigned int type,
+ bool premultiply_alpha,
+ bool flip_y);
+
// In general, We hold the most recently painted frame to increase the
// performance for the case that the same frame needs to be painted
// repeatedly. Call this function if you are sure the most recent frame will
@@ -85,6 +101,10 @@ class MEDIA_EXPORT SkCanvasVideoRenderer {
void ResetCache();
private:
+ // Update the cache holding the most-recently-painted frame.
+ void UpdateLastImage(const scoped_refptr<VideoFrame>& video_frame,
+ const Context3D& context_3d);
+
// Last image used to draw to the canvas.
sk_sp<SkImage> last_image_;
// Timestamp of the videoframe used to generate |last_image_|.

Powered by Google App Engine
This is Rietveld 408576698