Index: media/base/video_frame.h |
diff --git a/media/base/video_frame.h b/media/base/video_frame.h |
index 9a6f0a67fddb27b3eb5772ddd6f7e717744506c8..d8b00c33c25ee71fdeb0601f46514bb3be124c92 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,19 @@ 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( |
+#ifdef VIDEO_FRAME_MAILBOX |
+ const gpu::Mailbox& texture_mailbox, |
+ uint32 texture_mailbox_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, |
scherkus (not reviewing)
2013/04/17 20:09:34
OOC think we can remove the non-mailbox path after
danakj
2013/04/17 20:12:37
Yes absolutely. The no_longer_needed_cb is used fo
scherkus (not reviewing)
2013/04/17 20:16:58
Slick!
|
const base::Closure& no_longer_needed_cb); |
// Read pixels from the native texture backing |*this| and write |
@@ -156,9 +165,23 @@ 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; |
+#ifdef VIDEO_FRAME_MAILBOX |
+ // 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); |
+#else |
+ // Returns the native texture wrapped by this frame. Only valid to call if |
+ // this is a NATIVE_TEXTURE frame. |
+ uint32 texture_id() const; |
+#endif |
// Returns the texture target. Only valid for NATIVE_TEXTURE frames. |
uint32 texture_target() const; |
@@ -215,10 +238,16 @@ 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. |
+ // Native texture mailbox, if this is a NATIVE_TEXTURE frame. |
+#ifdef VIDEO_FRAME_MAILBOX |
+ gpu::Mailbox texture_mailbox_; |
+ uint32 texture_mailbox_sync_point_; |
+#else |
uint32 texture_id_; |
+#endif |
uint32 texture_target_; |
ReadPixelsCB read_pixels_cb_; |
+ TextureNoLongerNeededCallback texture_no_longer_needed_cb_; |
base::Closure no_longer_needed_cb_; |