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

Side by Side 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: remove unnecessary change 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 | « media/blink/webmediaplayer_impl.cc ('k') | media/renderers/skcanvas_video_renderer.cc » ('j') | 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 #ifndef MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ 5 #ifndef MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_
6 #define MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ 6 #define MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. 71 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE.
72 static void CopyVideoFrameSingleTextureToGLTexture( 72 static void CopyVideoFrameSingleTextureToGLTexture(
73 gpu::gles2::GLES2Interface* gl, 73 gpu::gles2::GLES2Interface* gl,
74 VideoFrame* video_frame, 74 VideoFrame* video_frame,
75 unsigned int texture, 75 unsigned int texture,
76 unsigned int internal_format, 76 unsigned int internal_format,
77 unsigned int type, 77 unsigned int type,
78 bool premultiply_alpha, 78 bool premultiply_alpha,
79 bool flip_y); 79 bool flip_y);
80 80
81 // Copy the contents of texture of |video_frame| to texture |texture| in
82 // context |destination_gl|.
83 // |level|, |internal_format|, |type| specify target texture |texture|.
84 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE.
85 // |context_3d| has a GrContext that may be used during the copy.
86 // Returns true on success.
87 bool CopyVideoFrameTexturesToGLTexture(
88 const Context3D& context_3d,
89 gpu::gles2::GLES2Interface* destination_gl,
90 const scoped_refptr<VideoFrame>& video_frame,
91 unsigned int texture,
92 unsigned int internal_format,
93 unsigned int type,
94 bool premultiply_alpha,
95 bool flip_y);
96
81 // In general, We hold the most recently painted frame to increase the 97 // In general, We hold the most recently painted frame to increase the
82 // performance for the case that the same frame needs to be painted 98 // performance for the case that the same frame needs to be painted
83 // repeatedly. Call this function if you are sure the most recent frame will 99 // repeatedly. Call this function if you are sure the most recent frame will
84 // never be painted again, so we can release the resource. 100 // never be painted again, so we can release the resource.
85 void ResetCache(); 101 void ResetCache();
86 102
87 private: 103 private:
104 // Update the cache holding the most-recently-painted frame. Returns false
105 // if the image couldn't be updated.
106 bool UpdateLastImage(const scoped_refptr<VideoFrame>& video_frame,
107 const Context3D& context_3d);
108
88 // Last image used to draw to the canvas. 109 // Last image used to draw to the canvas.
89 sk_sp<SkImage> last_image_; 110 sk_sp<SkImage> last_image_;
90 // Timestamp of the videoframe used to generate |last_image_|. 111 // Timestamp of the videoframe used to generate |last_image_|.
91 base::TimeDelta last_timestamp_ = media::kNoTimestamp; 112 base::TimeDelta last_timestamp_ = media::kNoTimestamp;
92 // If |last_image_| is not used for a while, it's deleted to save memory. 113 // If |last_image_| is not used for a while, it's deleted to save memory.
93 base::DelayTimer last_image_deleting_timer_; 114 base::DelayTimer last_image_deleting_timer_;
94 115
95 // Used for DCHECKs to ensure method calls executed in the correct thread. 116 // Used for DCHECKs to ensure method calls executed in the correct thread.
96 base::ThreadChecker thread_checker_; 117 base::ThreadChecker thread_checker_;
97 118
98 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); 119 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer);
99 }; 120 };
100 121
101 } // namespace media 122 } // namespace media
102 123
103 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ 124 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/renderers/skcanvas_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698