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

Unified Diff: cc/layers/video_frame_provider_client_impl.cc

Issue 1083383005: Connect the new video rendering path to the compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vra
Patch Set: Update LoginCustomFlags histogram. Created 5 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 | « cc/layers/video_frame_provider_client_impl.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/video_frame_provider_client_impl.cc
diff --git a/cc/layers/video_frame_provider_client_impl.cc b/cc/layers/video_frame_provider_client_impl.cc
index 3ca39efda389cb4c2b00092b5872f3c8094d3524..17bf3e6640c749a7644a4f068ac6efaa743814b7 100644
--- a/cc/layers/video_frame_provider_client_impl.cc
+++ b/cc/layers/video_frame_provider_client_impl.cc
@@ -24,7 +24,8 @@ VideoFrameProviderClientImpl::VideoFrameProviderClientImpl(
: provider_(provider),
client_(client),
active_video_layer_(nullptr),
- stopped_(false) {
+ stopped_(false),
+ rendering_(false) {
// This only happens during a commit on the compositor thread while the main
// thread is blocked. That makes this a thread-safe call to set the video
// frame provider client that does not require a lock. The same is true of
@@ -64,7 +65,8 @@ void VideoFrameProviderClientImpl::Stop() {
provider_->SetVideoFrameProviderClient(nullptr);
provider_ = nullptr;
}
- client_->RemoveVideoFrameController(this);
+ if (rendering_)
+ StopRendering();
active_video_layer_ = nullptr;
stopped_ = true;
}
@@ -107,16 +109,26 @@ void VideoFrameProviderClientImpl::StopUsingProvider() {
// using the frame.
base::AutoLock locker(provider_lock_);
provider_ = nullptr;
+ if (rendering_)
+ StopRendering();
}
void VideoFrameProviderClientImpl::StartRendering() {
- // TODO(dalecurtis, sunnyps): Hook this method up to control when to start
- // observing vsync intervals. http://crbug.com/336733
+ DCHECK(thread_checker_.CalledOnValidThread());
+ TRACE_EVENT0("cc", "VideoFrameProviderClientImpl::StartRendering");
+ DCHECK(!rendering_);
+ DCHECK(!stopped_);
+ client_->AddVideoFrameController(this);
+ rendering_ = true;
}
void VideoFrameProviderClientImpl::StopRendering() {
- // TODO(dalecurtis, sunnyps): Hook this method up to control when to stop
- // observing vsync intervals. http://crbug.com/336733
+ DCHECK(thread_checker_.CalledOnValidThread());
+ TRACE_EVENT0("cc", "VideoFrameProviderClientImpl::StopRendering");
+ DCHECK(rendering_);
+ DCHECK(!stopped_);
+ client_->RemoveVideoFrameController(this);
+ rendering_ = false;
}
void VideoFrameProviderClientImpl::DidReceiveFrame() {
@@ -142,7 +154,21 @@ void VideoFrameProviderClientImpl::DidUpdateMatrix(const float* matrix) {
void VideoFrameProviderClientImpl::OnBeginFrame(const BeginFrameArgs& args) {
DCHECK(thread_checker_.CalledOnValidThread());
- NOTIMPLEMENTED();
+ DCHECK(rendering_);
+ DCHECK(!stopped_);
+
+ TRACE_EVENT0("cc", "VideoFrameProviderClientImpl::OnBeginFrame");
+ base::AutoLock locker(provider_lock_);
+
+ // We use frame_time + interval here because that is the estimated time at
+ // which a frame returned during this phase will end up being displayed.
+ if (!provider_ ||
+ !provider_->UpdateCurrentFrame(args.frame_time + args.interval,
+ args.frame_time + 2 * args.interval)) {
+ return;
+ }
+
+ DidReceiveFrame();
}
} // namespace cc
« no previous file with comments | « cc/layers/video_frame_provider_client_impl.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698