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

Unified Diff: media/base/video_frame.cc

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: c301e01d Rebase. Created 6 years, 12 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
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 8a4eb3cce2b62f57daa5f4ee6dcf961157806a16..b71f4273e6f3708e38adbdd21cb39cf146082d10 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -91,24 +91,22 @@ bool VideoFrame::IsValidConfig(VideoFrame::Format format,
// static
scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
- scoped_ptr<MailboxHolder> mailbox_holder,
- uint32 texture_target,
+ scoped_ptr<gpu::MailboxHolder> mailbox_holder,
+ const ReleaseMailboxCB& mailbox_holder_release_cb,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
base::TimeDelta timestamp,
- const ReadPixelsCB& read_pixels_cb,
- const base::Closure& no_longer_needed_cb) {
+ const ReadPixelsCB& read_pixels_cb) {
scoped_refptr<VideoFrame> frame(new VideoFrame(NATIVE_TEXTURE,
coded_size,
visible_rect,
natural_size,
timestamp,
false));
- frame->texture_mailbox_holder_ = mailbox_holder.Pass();
- frame->texture_target_ = texture_target;
+ frame->mailbox_holder_ = mailbox_holder.Pass();
+ frame->mailbox_holder_release_cb_ = mailbox_holder_release_cb;
frame->read_pixels_cb_ = read_pixels_cb;
- frame->no_longer_needed_cb_ = no_longer_needed_cb;
return frame;
}
@@ -408,7 +406,6 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
coded_size_(coded_size),
visible_rect_(visible_rect),
natural_size_(natural_size),
- texture_target_(0),
shared_memory_handle_(base::SharedMemory::NULLHandle()),
timestamp_(timestamp),
end_of_stream_(end_of_stream) {
@@ -417,6 +414,10 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
}
VideoFrame::~VideoFrame() {
+ if (!mailbox_holder_release_cb_.is_null()) {
+ base::ResetAndReturn(&mailbox_holder_release_cb_)
+ .Run(mailbox_holder_.Pass());
+ }
if (!no_longer_needed_cb_.is_null())
base::ResetAndReturn(&no_longer_needed_cb_).Run();
}
@@ -487,14 +488,9 @@ uint8* VideoFrame::data(size_t plane) const {
return data_[plane];
}
-VideoFrame::MailboxHolder* VideoFrame::texture_mailbox() const {
- DCHECK_EQ(format_, NATIVE_TEXTURE);
- return texture_mailbox_holder_.get();
-}
-
-uint32 VideoFrame::texture_target() const {
+gpu::MailboxHolder* VideoFrame::mailbox_holder() const {
DCHECK_EQ(format_, NATIVE_TEXTURE);
- return texture_target_;
+ return mailbox_holder_.get();
}
base::SharedMemoryHandle VideoFrame::shared_memory_handle() const {
@@ -513,17 +509,4 @@ 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_);
-}
-
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698