| Index: content/common/gpu/client/gl_helper.cc
|
| diff --git a/content/common/gpu/client/gl_helper.cc b/content/common/gpu/client/gl_helper.cc
|
| index e8afdd1da9a740bd5107a6c658d54a58ba1e3fe6..0a10d4aa7e5229e1b18ac1b369ad52bdf29aeb3d 100644
|
| --- a/content/common/gpu/client/gl_helper.cc
|
| +++ b/content/common/gpu/client/gl_helper.cc
|
| @@ -154,7 +154,7 @@ class GLHelper::CopyTextureToImpl :
|
| const base::Callback<void(bool)>& callback);
|
|
|
| void ReadbackPlane(TextureFrameBufferPair* source,
|
| - media::VideoFrame* target,
|
| + const scoped_refptr<media::VideoFrame>& target,
|
| int plane,
|
| int size_shift,
|
| const gfx::Rect& dst_subrect,
|
| @@ -232,7 +232,7 @@ class GLHelper::CopyTextureToImpl :
|
| virtual void ReadbackYUV(
|
| const gpu::Mailbox& mailbox,
|
| uint32 sync_point,
|
| - media::VideoFrame* target,
|
| + const scoped_refptr<media::VideoFrame>& target,
|
| const base::Callback<void(bool)>& callback) OVERRIDE;
|
|
|
| virtual ScalerInterface* scaler() OVERRIDE {
|
| @@ -270,7 +270,7 @@ class GLHelper::CopyTextureToImpl :
|
| virtual void ReadbackYUV(
|
| const gpu::Mailbox& mailbox,
|
| uint32 sync_point,
|
| - media::VideoFrame* target,
|
| + const scoped_refptr<media::VideoFrame>& target,
|
| const base::Callback<void(bool)>& callback) OVERRIDE;
|
|
|
| virtual ScalerInterface* scaler() OVERRIDE {
|
| @@ -729,7 +729,7 @@ void GLHelper::CopyTextureFullImage(WebKit::WebGLId texture,
|
|
|
| void GLHelper::CopyTextureToImpl::ReadbackPlane(
|
| TextureFrameBufferPair* source,
|
| - media::VideoFrame* target,
|
| + const scoped_refptr<media::VideoFrame>& target,
|
| int plane,
|
| int size_shift,
|
| const gfx::Rect& dst_subrect,
|
| @@ -813,11 +813,17 @@ GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUVImpl(
|
| DCHECK(!(dst_subrect.y() & 1));
|
| }
|
|
|
| +static void CallbackKeepingVideoFrameAlive(
|
| + scoped_refptr<media::VideoFrame> video_frame,
|
| + const base::Callback<void(bool)>& callback,
|
| + bool success) {
|
| + callback.Run(success);
|
| +}
|
|
|
| void GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUV(
|
| const gpu::Mailbox& mailbox,
|
| uint32 sync_point,
|
| - media::VideoFrame *target,
|
| + const scoped_refptr<media::VideoFrame>& target,
|
| const base::Callback<void(bool)>& callback) {
|
| WebGLId mailbox_texture =
|
| copy_impl_->ConsumeMailboxToTexture(mailbox, sync_point);
|
| @@ -838,7 +844,8 @@ void GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUV(
|
| return;
|
| }
|
|
|
| - // Read back planes, one at a time.
|
| + // Read back planes, one at a time. Keep the video frame alive while doing the
|
| + // readback.
|
| copy_impl_->ReadbackPlane(y_.texture_and_framebuffer(),
|
| target,
|
| media::VideoFrame::kYPlane,
|
| @@ -856,7 +863,9 @@ void GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUV(
|
| media::VideoFrame::kVPlane,
|
| 1,
|
| dst_subrect_,
|
| - callback);
|
| + base::Bind(&CallbackKeepingVideoFrameAlive,
|
| + target,
|
| + callback));
|
| context_->bindFramebuffer(GL_FRAMEBUFFER, 0);
|
| media::LetterboxYUV(target, dst_subrect_);
|
| }
|
| @@ -933,7 +942,7 @@ GLHelper::CopyTextureToImpl::ReadbackYUV_MRT::ReadbackYUV_MRT(
|
| void GLHelper::CopyTextureToImpl::ReadbackYUV_MRT::ReadbackYUV(
|
| const gpu::Mailbox& mailbox,
|
| uint32 sync_point,
|
| - media::VideoFrame *target,
|
| + const scoped_refptr<media::VideoFrame>& target,
|
| const base::Callback<void(bool)>& callback) {
|
| WebGLId mailbox_texture =
|
| copy_impl_->ConsumeMailboxToTexture(mailbox, sync_point);
|
| @@ -976,7 +985,9 @@ void GLHelper::CopyTextureToImpl::ReadbackYUV_MRT::ReadbackYUV(
|
| media::VideoFrame::kVPlane,
|
| 1,
|
| dst_subrect_,
|
| - callback);
|
| + base::Bind(&CallbackKeepingVideoFrameAlive,
|
| + target,
|
| + callback));
|
| context_->bindFramebuffer(GL_FRAMEBUFFER, 0);
|
| media::LetterboxYUV(target, dst_subrect_);
|
| }
|
|
|