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

Unified Diff: media/base/video_frame.cc

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: rebase to ToT Created 6 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
« no previous file with comments | « media/base/video_frame.h ('k') | media/base/video_frame_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 87766651ce36d4d7d2ed7e8dca1ddd50c5a9fe9c..3d014550d356370696efbb910492eb89f5b8be30 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -50,8 +50,14 @@ scoped_refptr<VideoFrame> VideoFrame::CreateFrame(
return NULL;
}
DCHECK(IsValidConfig(format, new_coded_size, visible_rect, natural_size));
- scoped_refptr<VideoFrame> frame(new VideoFrame(
- format, new_coded_size, visible_rect, natural_size, timestamp, false));
+ scoped_refptr<VideoFrame> frame(
+ new VideoFrame(format,
+ new_coded_size,
+ visible_rect,
+ natural_size,
+ scoped_ptr<gpu::MailboxHolder>(),
+ timestamp,
+ false));
frame->AllocateYUV();
return frame;
}
@@ -145,9 +151,9 @@ scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
coded_size,
visible_rect,
natural_size,
+ mailbox_holder.Pass(),
timestamp,
false));
- frame->mailbox_holder_ = mailbox_holder.Pass();
frame->mailbox_holder_release_cb_ = mailbox_holder_release_cb;
frame->read_pixels_cb_ = read_pixels_cb;
@@ -178,8 +184,14 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalPackedMemory(
switch (format) {
case I420: {
- scoped_refptr<VideoFrame> frame(new VideoFrame(
- format, coded_size, visible_rect, natural_size, timestamp, false));
+ scoped_refptr<VideoFrame> frame(
+ new VideoFrame(format,
+ coded_size,
+ visible_rect,
+ natural_size,
+ scoped_ptr<gpu::MailboxHolder>(),
+ timestamp,
+ false));
frame->shared_memory_handle_ = handle;
frame->strides_[kYPlane] = coded_size.width();
frame->strides_[kUPlane] = coded_size.width() / 2;
@@ -213,8 +225,14 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvData(
if (!IsValidConfig(format, coded_size, visible_rect, natural_size))
return NULL;
- scoped_refptr<VideoFrame> frame(new VideoFrame(
- format, coded_size, visible_rect, natural_size, timestamp, false));
+ scoped_refptr<VideoFrame> frame(
+ new VideoFrame(format,
+ coded_size,
+ visible_rect,
+ natural_size,
+ scoped_ptr<gpu::MailboxHolder>(),
+ timestamp,
+ false));
frame->strides_[kYPlane] = y_stride;
frame->strides_[kUPlane] = u_stride;
frame->strides_[kVPlane] = v_stride;
@@ -236,9 +254,14 @@ scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame(
CHECK(frame->format() != NATIVE_TEXTURE);
DCHECK(frame->visible_rect().Contains(visible_rect));
- scoped_refptr<VideoFrame> wrapped_frame(new VideoFrame(
- frame->format(), frame->coded_size(), visible_rect, natural_size,
- frame->timestamp(), frame->end_of_stream()));
+ scoped_refptr<VideoFrame> wrapped_frame(
+ new VideoFrame(frame->format(),
+ frame->coded_size(),
+ visible_rect,
+ natural_size,
+ scoped_ptr<gpu::MailboxHolder>(),
+ frame->timestamp(),
+ frame->end_of_stream()));
for (size_t i = 0; i < NumPlanes(frame->format()); ++i) {
wrapped_frame->strides_[i] = frame->stride(i);
@@ -255,6 +278,7 @@ scoped_refptr<VideoFrame> VideoFrame::CreateEOSFrame() {
gfx::Size(),
gfx::Rect(),
gfx::Size(),
+ scoped_ptr<gpu::MailboxHolder>(),
kNoTimestamp(),
true);
}
@@ -290,8 +314,14 @@ scoped_refptr<VideoFrame> VideoFrame::CreateBlackFrame(const gfx::Size& size) {
scoped_refptr<VideoFrame> VideoFrame::CreateHoleFrame(
const gfx::Size& size) {
DCHECK(IsValidConfig(VideoFrame::HOLE, size, gfx::Rect(size), size));
- scoped_refptr<VideoFrame> frame(new VideoFrame(
- VideoFrame::HOLE, size, gfx::Rect(size), size, base::TimeDelta(), false));
+ scoped_refptr<VideoFrame> frame(
+ new VideoFrame(VideoFrame::HOLE,
+ size,
+ gfx::Rect(size),
+ size,
+ scoped_ptr<gpu::MailboxHolder>(),
+ base::TimeDelta(),
+ false));
return frame;
}
#endif // defined(VIDEO_HOLE)
@@ -453,12 +483,14 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
+ scoped_ptr<gpu::MailboxHolder> mailbox_holder,
base::TimeDelta timestamp,
bool end_of_stream)
: format_(format),
coded_size_(coded_size),
visible_rect_(visible_rect),
natural_size_(natural_size),
+ mailbox_holder_(mailbox_holder.Pass()),
shared_memory_handle_(base::SharedMemory::NULLHandle()),
timestamp_(timestamp),
end_of_stream_(end_of_stream) {
@@ -470,8 +502,12 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
VideoFrame::~VideoFrame() {
if (!mailbox_holder_release_cb_.is_null()) {
- base::ResetAndReturn(&mailbox_holder_release_cb_)
- .Run(mailbox_holder_.Pass());
+ std::vector<uint32> release_sync_points;
+ {
+ base::AutoLock locker(release_sync_point_lock_);
+ release_sync_points_.swap(release_sync_points);
+ }
+ base::ResetAndReturn(&mailbox_holder_release_cb_).Run(release_sync_points);
}
if (!no_longer_needed_cb_.is_null())
base::ResetAndReturn(&no_longer_needed_cb_).Run();
@@ -543,7 +579,7 @@ uint8* VideoFrame::data(size_t plane) const {
return data_[plane];
}
-gpu::MailboxHolder* VideoFrame::mailbox_holder() const {
+const gpu::MailboxHolder* VideoFrame::mailbox_holder() const {
DCHECK_EQ(format_, NATIVE_TEXTURE);
return mailbox_holder_.get();
}
@@ -552,6 +588,14 @@ base::SharedMemoryHandle VideoFrame::shared_memory_handle() const {
return shared_memory_handle_;
}
+void VideoFrame::AppendReleaseSyncPoint(uint32 sync_point) {
+ DCHECK_EQ(format_, NATIVE_TEXTURE);
+ if (!sync_point)
+ return;
+ base::AutoLock locker(release_sync_point_lock_);
+ release_sync_points_.push_back(sync_point);
+}
+
void VideoFrame::HashFrameForTesting(base::MD5Context* context) {
for (int plane = 0; plane < kMaxPlanes; ++plane) {
if (!IsValidPlane(plane))
« no previous file with comments | « media/base/video_frame.h ('k') | media/base/video_frame_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698