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

Unified Diff: media/base/video_frame.cc

Issue 14199002: Send hardware video frames with mailboxes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux/windows hardware path Created 7 years, 8 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 9c3b4b6075e8182778a957316e5222a40bf65130..f6c8010ec22c090d36e77f2350c9e81539bffff4 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -63,20 +63,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_ = texture_mailbox;
+ frame->texture_mailbox_sync_point_ = sync_point;
frame->texture_target_ = texture_target;
frame->read_pixels_cb_ = read_pixels_cb;
frame->no_longer_needed_cb_ = no_longer_needed_cb;
+ frame->texture_no_longer_needed_cb_ = texture_no_longer_needed_cb;
return frame;
}
@@ -253,7 +257,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_));
@@ -261,6 +264,10 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
}
VideoFrame::~VideoFrame() {
+ if (!texture_no_longer_needed_cb_.is_null()) {
+ base::ResetAndReturn(&texture_no_longer_needed_cb_).Run(
+ texture_mailbox_sync_point_);
+ }
if (!no_longer_needed_cb_.is_null())
base::ResetAndReturn(&no_longer_needed_cb_).Run();
}
@@ -325,9 +332,19 @@ uint8* VideoFrame::data(size_t plane) const {
return data_[plane];
}
-uint32 VideoFrame::texture_id() const {
+const gpu::Mailbox& VideoFrame::texture_mailbox() const {
+ DCHECK_EQ(format_, NATIVE_TEXTURE);
+ return texture_mailbox_;
+}
+
+uint32 VideoFrame::texture_mailbox_sync_point() const {
+ DCHECK_EQ(format_, NATIVE_TEXTURE);
+ return texture_mailbox_sync_point_;
+}
+
+void VideoFrame::set_texture_mailbox_sync_point(uint32 sync_point) {
DCHECK_EQ(format_, NATIVE_TEXTURE);
- return texture_id_;
+ texture_mailbox_sync_point_ = sync_point;
}
uint32 VideoFrame::texture_target() const {

Powered by Google App Engine
This is Rietveld 408576698