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

Unified Diff: media/blink/skcanvas_video_renderer.h

Issue 1144323003: media: Refactor SkCanvasVideoRenderer to use SkImages and not SkBitmaps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/scoped_refptr<VideoFrame>&/VideoFrame*/ where possible. Created 5 years, 4 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
« no previous file with comments | « media/base/run_all_unittests.cc ('k') | media/blink/skcanvas_video_renderer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/skcanvas_video_renderer.h
diff --git a/media/blink/skcanvas_video_renderer.h b/media/blink/skcanvas_video_renderer.h
index 12b909af1bd576424744efb94a8c9a24e7cea480..d6242bc990521657c2cccfafb5f5bef9f2f41120 100644
--- a/media/blink/skcanvas_video_renderer.h
+++ b/media/blink/skcanvas_video_renderer.h
@@ -9,22 +9,21 @@
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "media/base/media_export.h"
+#include "media/base/video_frame.h"
#include "media/base/video_rotation.h"
#include "media/filters/context_3d.h"
-#include "third_party/skia/include/core/SkBitmap.h"
+#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkXfermode.h"
#include "ui/gfx/geometry/rect.h"
class SkCanvas;
+class SkImage;
namespace media {
-
-class VideoFrame;
class VideoImageGenerator;
-// Handles rendering of VideoFrames to SkCanvases, doing any necessary YUV
-// conversion and caching of resulting RGB bitmaps.
+// Handles rendering of VideoFrames to SkCanvases.
class MEDIA_EXPORT SkCanvasVideoRenderer {
public:
SkCanvasVideoRenderer();
@@ -54,10 +53,9 @@ class MEDIA_EXPORT SkCanvasVideoRenderer {
// Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels|
// should point into a buffer large enough to hold as many 32 bit RGBA pixels
// as are in the visible_rect() area of the frame.
- static void ConvertVideoFrameToRGBPixels(
- const scoped_refptr<media::VideoFrame>& video_frame,
- void* rgb_pixels,
- size_t row_bytes);
+ static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame,
+ void* rgb_pixels,
+ size_t row_bytes);
// Copy the contents of texture of |video_frame| to texture |texture|.
// |level|, |internal_format|, |type| specify target texture |texture|.
@@ -72,25 +70,14 @@ class MEDIA_EXPORT SkCanvasVideoRenderer {
bool flip_y);
private:
- void ResetLastFrame();
- void ResetAcceleratedLastFrame();
-
- // An RGB bitmap and corresponding timestamp of the previously converted
- // video frame data by software color space conversion.
- SkBitmap last_frame_;
- base::TimeDelta last_frame_timestamp_;
- // If |last_frame_| is not used for a while, it's deleted to save memory.
- base::DelayTimer<SkCanvasVideoRenderer> frame_deleting_timer_;
-
- // This is a hardware accelerated copy of the frame generated by
- // |accelerated_generator_|.
- // It's used when |canvas| parameter in Paint() is Ganesh canvas.
- // Note: all GrContext in SkCanvas instances are same.
- scoped_ptr<SkImage> accelerated_last_image_;
- SkBitmap accelerated_last_frame_;
- VideoImageGenerator* accelerated_generator_;
- base::TimeDelta accelerated_last_frame_timestamp_;
- base::DelayTimer<SkCanvasVideoRenderer> accelerated_frame_deleting_timer_;
+ void ResetCache();
+
+ // Last image used to draw to the canvas.
+ skia::RefPtr<SkImage> last_image_;
+ // Timestamp of the videoframe used to generate |last_image_|.
+ base::TimeDelta last_timestamp_ = media::kNoTimestamp();
+ // If |last_image_| is not used for a while, it's deleted to save memory.
+ base::DelayTimer<SkCanvasVideoRenderer> last_image_deleting_timer_;
DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer);
};
« no previous file with comments | « media/base/run_all_unittests.cc ('k') | media/blink/skcanvas_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698