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

Unified Diff: media/base/video_frame.cc

Issue 312803002: Android media: VideoFrame should not store so many sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ios build Created 6 years, 5 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 f6b49e483d68e07bc2f3c436a9bf1fce4b654274..456cf6e9d887bc089e4c899db1cb84d9e99fd3d3 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -666,6 +666,7 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
mailbox_holder_(mailbox_holder.Pass()),
shared_memory_handle_(base::SharedMemory::NULLHandle()),
timestamp_(timestamp),
+ release_sync_point_(0),
end_of_stream_(end_of_stream) {
DCHECK(IsValidConfig(format_, coded_size_, visible_rect_, natural_size_));
@@ -675,12 +676,14 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
VideoFrame::~VideoFrame() {
if (!mailbox_holder_release_cb_.is_null()) {
- std::vector<uint32> release_sync_points;
+ uint32 release_sync_point;
{
+ // To ensure that changes to |release_sync_point_| are visible on this
+ // thread (imply a memory barrier).
base::AutoLock locker(release_sync_point_lock_);
- release_sync_points_.swap(release_sync_points);
+ release_sync_point = release_sync_point_;
}
- base::ResetAndReturn(&mailbox_holder_release_cb_).Run(release_sync_points);
+ base::ResetAndReturn(&mailbox_holder_release_cb_).Run(release_sync_point);
}
if (!no_longer_needed_cb_.is_null())
base::ResetAndReturn(&no_longer_needed_cb_).Run();
@@ -832,12 +835,15 @@ base::SharedMemoryHandle VideoFrame::shared_memory_handle() const {
return shared_memory_handle_;
}
-void VideoFrame::AppendReleaseSyncPoint(uint32 sync_point) {
+void VideoFrame::UpdateReleaseSyncPoint(SyncPointClient* client) {
DCHECK_EQ(format_, NATIVE_TEXTURE);
- if (!sync_point)
- return;
base::AutoLock locker(release_sync_point_lock_);
- release_sync_points_.push_back(sync_point);
+ // Must wait on the previous sync point before inserting a new sync point so
+ // that |mailbox_holder_release_cb_| guarantees the previous sync point
+ // occurred when it waits on |release_sync_point_|.
+ if (release_sync_point_)
+ client->WaitSyncPoint(release_sync_point_);
+ release_sync_point_ = client->InsertSyncPoint();
}
#if defined(OS_POSIX)
« 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