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

Unified Diff: media/base/video_frame.h

Issue 175223003: HW Video: Make media::VideoFrame handle the sync point of the compositor as well as webgl (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Focus on this CL's goal and remove wrong change Created 6 years, 9 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 0c69627aa207d4d4b3ccf856af2052ec9ec17fe5..5e986ede5a88a06d4ba808785bbb77009ffe0688 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -5,9 +5,12 @@
#ifndef MEDIA_BASE_VIDEO_FRAME_H_
#define MEDIA_BASE_VIDEO_FRAME_H_
+#include <vector>
+
#include "base/callback.h"
#include "base/md5.h"
#include "base/memory/shared_memory.h"
+#include "base/synchronization/lock.h"
#include "media/base/buffers.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
@@ -85,7 +88,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// CB to be called on the mailbox backing this frame when the frame is
// destroyed.
- typedef base::Callback<void(scoped_ptr<gpu::MailboxHolder>)> ReleaseMailboxCB;
+ typedef base::Callback<void(const std::vector<uint32>&)> ReleaseMailboxCB;
Ami GONE FROM CHROMIUM 2014/04/11 20:55:17 FYI this is now a blocker for https://code.google.
// Wraps a native texture of the given parameters with a VideoFrame. The
// backing of the VideoFrame is held in the mailbox held by |mailbox_holder|,
@@ -225,6 +228,13 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
timestamp_ = timestamp;
}
+ // Append |sync_point| into |release_sync_points_| which will be passed to
+ // the video decoder when |mailbox_holder_release_cb_| is called so that
+ // the video decoder waits for the sync points before reusing the mailbox.
+ // Multiple clients can append multiple sync points in one frame.
Ami GONE FROM CHROMIUM 2014/04/11 20:55:17 s/in/to/
+ // This method is thread safe. Both blink and compositor threads can call it.
+ void AppendReleaseSyncPoint(uint32 sync_point);
+
// Used to keep a running hash of seen frames. Expects an initialized MD5
// context. Calls MD5Update with the context and the contents of the frame.
void HashFrameForTesting(base::MD5Context* context);
@@ -268,6 +278,9 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// Native texture mailbox, if this is a NATIVE_TEXTURE frame.
scoped_ptr<gpu::MailboxHolder> mailbox_holder_;
+#ifndef NDEBUG
+ uint32 debug_initial_sync_point_;
+#endif
ReleaseMailboxCB mailbox_holder_release_cb_;
ReadPixelsCB read_pixels_cb_;
@@ -278,6 +291,9 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
base::TimeDelta timestamp_;
+ base::Lock release_sync_point_lock_;
+ std::vector<uint32> release_sync_points_;
+
const bool end_of_stream_;
DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame);

Powered by Google App Engine
This is Rietveld 408576698