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

Side by Side Diff: media/blink/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: Fix unnecessay slow-down of YUV path Created 5 years, 2 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 #ifndef MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_ 5 #ifndef MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_
6 #define MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_ 6 #define MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels| 57 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels|
58 // should point into a buffer large enough to hold as many 32 bit RGBA pixels 58 // should point into a buffer large enough to hold as many 32 bit RGBA pixels
59 // as are in the visible_rect() area of the frame. 59 // as are in the visible_rect() area of the frame.
60 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame, 60 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame,
61 void* rgb_pixels, 61 void* rgb_pixels,
62 size_t row_bytes); 62 size_t row_bytes);
63 63
64 // Copy the contents of texture of |video_frame| to texture |texture|. 64 // Copy the contents of texture of |video_frame| to texture |texture|.
65 // |level|, |internal_format|, |type| specify target texture |texture|. 65 // |level|, |internal_format|, |type| specify target texture |texture|.
66 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. 66 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE.
67 struct CopyFrameSingleTextureParams {
68 enum CopyType { FullCopy, SubCopy };
69 CopyFrameSingleTextureParams() = delete;
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 };
67 static void CopyVideoFrameSingleTextureToGLTexture( 91 static void CopyVideoFrameSingleTextureToGLTexture(
68 gpu::gles2::GLES2Interface* gl, 92 gpu::gles2::GLES2Interface* gl,
69 VideoFrame* video_frame, 93 VideoFrame* video_frame,
70 unsigned int texture, 94 const CopyFrameSingleTextureParams& params);
71 unsigned int internal_format,
72 unsigned int type,
73 bool premultiply_alpha,
74 bool flip_y);
75 95
76 private: 96 private:
77 void ResetCache(); 97 void ResetCache();
78 98
79 // Last image used to draw to the canvas. 99 // Last image used to draw to the canvas.
80 skia::RefPtr<SkImage> last_image_; 100 skia::RefPtr<SkImage> last_image_;
81 // Timestamp of the videoframe used to generate |last_image_|. 101 // Timestamp of the videoframe used to generate |last_image_|.
82 base::TimeDelta last_timestamp_ = media::kNoTimestamp(); 102 base::TimeDelta last_timestamp_ = media::kNoTimestamp();
83 // 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.
84 base::DelayTimer last_image_deleting_timer_; 104 base::DelayTimer last_image_deleting_timer_;
85 105
86 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); 106 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer);
87 }; 107 };
88 108
89 } // namespace media 109 } // namespace media
90 110
91 #endif // MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_ 111 #endif // MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698