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

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: previous patchset has unrelated code by mistake. Created 6 years, 10 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 b3458a5954992b542094c217e46011d77576f7b5..24f0e7b19a70a8cbb59c9aa5a467dd0f6c44bbe4 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -106,6 +106,9 @@ scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
frame->mailbox_holder_ = mailbox_holder.Pass();
frame->mailbox_holder_release_cb_ = mailbox_holder_release_cb;
frame->read_pixels_cb_ = read_pixels_cb;
+#ifndef NDEBUG
+ frame->debug_initial_sync_point_ = frame->mailbox_holder_->sync_point;
+#endif
return frame;
}
@@ -113,7 +116,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
void VideoFrame::ReadPixelsFromNativeTexture(const SkBitmap& pixels) {
DCHECK_EQ(format_, NATIVE_TEXTURE);
if (!read_pixels_cb_.is_null())
- read_pixels_cb_.Run(pixels);
+ read_pixels_cb_.Run(this, pixels);
}
// static
@@ -403,6 +406,9 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
coded_size_(coded_size),
visible_rect_(visible_rect),
natural_size_(natural_size),
+#ifndef NDEBUG
+ debug_initial_sync_point_(0),
+#endif
shared_memory_handle_(base::SharedMemory::NULLHandle()),
timestamp_(timestamp),
end_of_stream_(end_of_stream) {
@@ -412,8 +418,22 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
VideoFrame::~VideoFrame() {
if (!mailbox_holder_release_cb_.is_null()) {
+ std::vector<uint32> release_sync_points;
+ {
+ base::AutoLock locker(release_sync_point_lock_);
+ release_sync_points_.swap(release_sync_points);
+ }
+#ifndef NDEBUG
+ // VideoFrame doesn't use |mailbox_holder_->sync_point| as release sync
+ // point because VideoFrame can have multiple clients. i.e. the compositor,
+ // webgl. So VideoFrame uses |release_sync_points_| unlike webgl.
+ // mailbox_holder_->sync_point must be not changed by clients.
+ DCHECK_EQ(debug_initial_sync_point_, mailbox_holder_->sync_point);
+ for (size_t i = 0; i < release_sync_points.size(); i++)
+ DCHECK_NE(debug_initial_sync_point_, release_sync_points[i]);
+#endif
base::ResetAndReturn(&mailbox_holder_release_cb_)
- .Run(mailbox_holder_.Pass());
+ .Run(mailbox_holder_.Pass(), release_sync_points);
}
if (!no_longer_needed_cb_.is_null())
base::ResetAndReturn(&no_longer_needed_cb_).Run();
@@ -494,6 +514,12 @@ base::SharedMemoryHandle VideoFrame::shared_memory_handle() const {
return shared_memory_handle_;
}
+void VideoFrame::AppendReleaseSyncPoint(uint32 sync_point) {
+ DCHECK_EQ(format_, NATIVE_TEXTURE);
+ 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))

Powered by Google App Engine
This is Rietveld 408576698