Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
media: Remove SkCanvasVideoRenderer cache invalidation.
Browse files Browse the repository at this point in the history
When VideoFrame carries one native texture, with a GL_TEXTURE_2D target,
we assumed we could avoid caching the created SkImage, since we just used
the texture directly for drawing.
Unfortunately if we're drawing to a software canvas we need to read the pixels
back from the texture, and that is expensive.
Keeping the same SkImage allows Skia to cache the expensive operation.

BUG=521531

Review URL: https://codereview.chromium.org/1320613003

Cr-Commit-Position: refs/heads/master@{#345799}
  • Loading branch information
DCastagna authored and Commit bot committed Aug 27, 2015
1 parent ebddb0b commit 771b5cf
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions media/blink/skcanvas_video_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,6 @@ skia::RefPtr<SkImage> NewSkImageFromVideoFrameYUVTextures(
return skia::AdoptRef(img);
}

bool ShouldCacheVideoFrameSkImage(const VideoFrame* video_frame) {
return !video_frame->HasTextures() ||
media::VideoFrame::NumPlanes(video_frame->format()) != 1 ||
video_frame->mailbox_holder(0).texture_target != GL_TEXTURE_2D;
}

// Creates a SkImage from a |video_frame| backed by native resources.
// The SkImage will take ownership of the underlying resource.
skia::RefPtr<SkImage> NewSkImageFromVideoFrameNative(
Expand Down Expand Up @@ -388,9 +382,6 @@ void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame,
// Make sure to flush so we can remove the videoframe from the generator.
canvas->flush();

if (!ShouldCacheVideoFrameSkImage(video_frame.get()))
ResetCache();

if (video_frame->HasTextures()) {
DCHECK(gl);
SyncPointClientImpl client(gl);
Expand Down

0 comments on commit 771b5cf

Please sign in to comment.