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

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

Issue 1315323006: webgl: optimize webgl.texSubImage2D(video) path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to ToT Created 5 years, 1 month 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 "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels| 58 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels|
59 // should point into a buffer large enough to hold as many 32 bit RGBA pixels 59 // should point into a buffer large enough to hold as many 32 bit RGBA pixels
60 // as are in the visible_rect() area of the frame. 60 // as are in the visible_rect() area of the frame.
61 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame, 61 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame,
62 void* rgb_pixels, 62 void* rgb_pixels,
63 size_t row_bytes); 63 size_t row_bytes);
64 64
65 // Copy the contents of texture of |video_frame| to texture |texture|. 65 // Copy the contents of texture of |video_frame| to texture |texture|.
66 // |level|, |internal_format|, |type| specify target texture |texture|. 66 // |level|, |internal_format|, |type| specify target texture |texture|.
67 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. 67 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE.
68 struct MEDIA_EXPORT CopyFrameSingleTextureParams {
69 enum CopyType { FullCopy, SubCopy };
70 CopyFrameSingleTextureParams(CopyType copy_type,
71 unsigned target,
72 unsigned texture,
73 unsigned internal_format,
74 unsigned type,
75 int level,
76 int xoffset,
77 int yoffset,
78 bool premultiply_alpha,
79 bool flip_y);
80 CopyType copy_type;
81 unsigned int target;
82 unsigned int texture;
83 unsigned int internal_format;
84 unsigned int type;
85 int level;
86 int xoffset;
87 int yoffset;
88 bool premultiply_alpha;
89 bool flip_y;
90 };
68 static void CopyVideoFrameSingleTextureToGLTexture( 91 static void CopyVideoFrameSingleTextureToGLTexture(
69 gpu::gles2::GLES2Interface* gl, 92 gpu::gles2::GLES2Interface* gl,
70 VideoFrame* video_frame, 93 VideoFrame* video_frame,
71 unsigned int texture, 94 const CopyFrameSingleTextureParams& params);
72 unsigned int internal_format,
73 unsigned int type,
74 bool premultiply_alpha,
75 bool flip_y);
76 95
77 private: 96 private:
78 void ResetCache(); 97 void ResetCache();
79 98
80 // Last image used to draw to the canvas. 99 // Last image used to draw to the canvas.
81 skia::RefPtr<SkImage> last_image_; 100 skia::RefPtr<SkImage> last_image_;
82 // Timestamp of the videoframe used to generate |last_image_|. 101 // Timestamp of the videoframe used to generate |last_image_|.
83 base::TimeDelta last_timestamp_ = media::kNoTimestamp(); 102 base::TimeDelta last_timestamp_ = media::kNoTimestamp();
84 // If |last_image_| is not used for a while, it's deleted to save memory. 103 // If |last_image_| is not used for a while, it's deleted to save memory.
85 base::DelayTimer last_image_deleting_timer_; 104 base::DelayTimer last_image_deleting_timer_;
86 105
87 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); 106 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer);
88 }; 107 };
89 108
90 } // namespace media 109 } // namespace media
91 110
92 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ 111 #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