Chromium Code Reviews| Index: media/base/video_frame.cc |
| diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc |
| index 046967c8fd142fdae7d5fd3eb55f33a3d0ad0e4b..3f355a375d701d911d5e4bba89970b55e57fc017 100644 |
| --- a/media/base/video_frame.cc |
| +++ b/media/base/video_frame.cc |
| @@ -64,20 +64,24 @@ bool VideoFrame::IsValidConfig(VideoFrame::Format format, |
| // static |
| scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture( |
| - uint32 texture_id, |
| + const gpu::Mailbox& texture_mailbox, |
| + uint32 sync_point, |
| uint32 texture_target, |
| const gfx::Size& coded_size, |
| const gfx::Rect& visible_rect, |
| const gfx::Size& natural_size, |
| base::TimeDelta timestamp, |
| const ReadPixelsCB& read_pixels_cb, |
| + const TextureNoLongerNeededCallback& texture_no_longer_needed_cb, |
| const base::Closure& no_longer_needed_cb) { |
| scoped_refptr<VideoFrame> frame(new VideoFrame( |
| NATIVE_TEXTURE, coded_size, visible_rect, natural_size, timestamp)); |
| - frame->texture_id_ = texture_id; |
| + frame->texture_mailbox_holder_ = new MailboxHolder( |
| + texture_mailbox, sync_point, texture_no_longer_needed_cb); |
| frame->texture_target_ = texture_target; |
| frame->read_pixels_cb_ = read_pixels_cb; |
| frame->no_longer_needed_cb_ = no_longer_needed_cb; |
| + |
| return frame; |
| } |
| @@ -266,7 +270,6 @@ VideoFrame::VideoFrame(VideoFrame::Format format, |
| coded_size_(coded_size), |
| visible_rect_(visible_rect), |
| natural_size_(natural_size), |
| - texture_id_(0), |
| texture_target_(0), |
| timestamp_(timestamp) { |
| memset(&strides_, 0, sizeof(strides_)); |
| @@ -340,9 +343,10 @@ uint8* VideoFrame::data(size_t plane) const { |
| return data_[plane]; |
| } |
| -uint32 VideoFrame::texture_id() const { |
| +const scoped_refptr<VideoFrame::MailboxHolder>& VideoFrame::texture_mailbox() |
| + const { |
| DCHECK_EQ(format_, NATIVE_TEXTURE); |
| - return texture_id_; |
| + return texture_mailbox_holder_; |
| } |
| uint32 VideoFrame::texture_target() const { |
| @@ -366,4 +370,17 @@ void VideoFrame::HashFrameForTesting(base::MD5Context* context) { |
| } |
| } |
| +VideoFrame::MailboxHolder::MailboxHolder( |
| + const gpu::Mailbox& mailbox, |
| + unsigned sync_point, |
| + const TextureNoLongerNeededCallback& release_callback) |
| + : mailbox_(mailbox), |
| + sync_point_(sync_point), |
| + release_callback_(release_callback) {} |
| + |
| +VideoFrame::MailboxHolder::~MailboxHolder() { |
| + if (!release_callback_.is_null()) |
| + release_callback_.Run(sync_point_); |
|
scherkus (not reviewing)
2013/06/17 20:20:37
are we worried about clients calling texture_mailb
danakj
2013/06/18 00:45:05
That is intended. The compositor may hold onto the
scherkus (not reviewing)
2013/06/18 00:52:18
Gotcha -- thanks for the background info!
Seeing
danakj
2013/06/18 16:54:12
Done.
|
| +} |
| + |
| } // namespace media |