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

Unified Diff: media/base/video_frame.h

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.h
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index 9a6f0a67fddb27b3eb5772ddd6f7e717744506c8..fb5cb80b9474cdbfaf0416028033ffa5d0d031af 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -7,6 +7,7 @@
#include "base/callback.h"
#include "base/md5.h"
+#include "gpu/command_buffer/common/mailbox.h"
#include "media/base/buffers.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
@@ -49,6 +50,8 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
#endif
};
+ typedef base::Callback<void(uint32 sync_point)> TextureNoLongerNeededCallback;
+
// Creates a new frame in system memory with given parameters. Buffers for
// the frame are allocated but not initialized.
// |coded_size| is the width and height of the frame data in pixels.
@@ -85,13 +88,15 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// |read_pixels_cb| may be used to do (slow!) readbacks from the
// texture to main memory.
static scoped_refptr<VideoFrame> WrapNativeTexture(
- uint32 texture_id,
+ const gpu::Mailbox& texture_mailbox,
+ uint32 texture_mailbox_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);
// Read pixels from the native texture backing |*this| and write
@@ -156,9 +161,17 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// VideoFrame object and must not be freed by the caller.
uint8* data(size_t plane) const;
- // Returns the ID of the native texture wrapped by this frame. Only valid to
- // call if this is a NATIVE_TEXTURE frame.
- uint32 texture_id() const;
+ // Returns the mailbox of the native texture wrapped by this frame. Only
+ // valid to call if this is a NATIVE_TEXTURE frame.
+ const gpu::Mailbox& texture_mailbox() const;
+
+ // Before using the texture_mailbox, the consumer must wait on this sync
+ // point. Only valid to call if this is a NATIVE_TEXTURE frame.
+ uint32 texture_mailbox_sync_point() const;
+
+ // Reset the sync point to a new value. Only valid to call if this is a
+ // NATIVE_TEXTURE frame.
+ void set_texture_mailbox_sync_point(uint32 sync_point);
// Returns the texture target. Only valid for NATIVE_TEXTURE frames.
uint32 texture_target() const;
@@ -215,10 +228,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// Array of data pointers to each plane.
uint8* data_[kMaxPlanes];
- // Native texture ID, if this is a NATIVE_TEXTURE frame.
- uint32 texture_id_;
+ // Native texture mailbox, if this is a NATIVE_TEXTURE frame.
+ gpu::Mailbox texture_mailbox_;
+ uint32 texture_mailbox_sync_point_;
uint32 texture_target_;
ReadPixelsCB read_pixels_cb_;
+ TextureNoLongerNeededCallback texture_no_longer_needed_cb_;
base::Closure no_longer_needed_cb_;

Powered by Google App Engine
This is Rietveld 408576698