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

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: Ifdefed 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 62e81ca574d841f07127e7a50a6896bf8dc6bba2..da607143e6e62b14a70cba1fb5b794fd50a699cd 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -63,20 +63,32 @@ bool VideoFrame::IsValidConfig(VideoFrame::Format format,
// static
scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
+#ifdef VIDEO_FRAME_MAILBOX
+ const gpu::Mailbox& texture_mailbox,
+ uint32 sync_point,
+#else
uint32 texture_id,
+#endif
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));
+#ifdef VIDEO_FRAME_MAILBOX
+ frame->texture_mailbox_ = texture_mailbox;
+ frame->texture_mailbox_sync_point_ = sync_point;
+#else
frame->texture_id_ = texture_id;
+#endif
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 +265,9 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
coded_size_(coded_size),
visible_rect_(visible_rect),
natural_size_(natural_size),
+#ifndef VIDEO_FRAME_MAILBOX
texture_id_(0),
+#endif
texture_target_(0),
timestamp_(timestamp) {
memset(&strides_, 0, sizeof(strides_));
@@ -261,6 +275,14 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
}
VideoFrame::~VideoFrame() {
+ if (!texture_no_longer_needed_cb_.is_null()) {
+ base::ResetAndReturn(&texture_no_longer_needed_cb_).Run(
+#ifdef VIDEO_FRAME_MAILBOX
+ texture_mailbox_sync_point_);
+#else
+ 0);
+#endif
+ }
if (!no_longer_needed_cb_.is_null())
base::ResetAndReturn(&no_longer_needed_cb_).Run();
}
@@ -325,10 +347,27 @@ uint8* VideoFrame::data(size_t plane) const {
return data_[plane];
}
+#ifdef VIDEO_FRAME_MAILBOX
+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);
+ texture_mailbox_sync_point_ = sync_point;
+}
+#else
uint32 VideoFrame::texture_id() const {
DCHECK_EQ(format_, NATIVE_TEXTURE);
return texture_id_;
}
+#endif
uint32 VideoFrame::texture_target() const {
DCHECK_EQ(format_, NATIVE_TEXTURE);

Powered by Google App Engine
This is Rietveld 408576698