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

Unified Diff: content/renderer/media/webmediaplayer_impl.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: Add WaitSyncPoint in WMPImpl::paint(...) 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: content/renderer/media/webmediaplayer_impl.cc
diff --git a/content/renderer/media/webmediaplayer_impl.cc b/content/renderer/media/webmediaplayer_impl.cc
index 411b814757cd4c0f737f2fb995bd249ecee8962f..44afd0ad684e20eff508498fa13251f954453f88 100644
--- a/content/renderer/media/webmediaplayer_impl.cc
+++ b/content/renderer/media/webmediaplayer_impl.cc
@@ -535,8 +535,21 @@ void WebMediaPlayerImpl::paint(WebCanvas* canvas,
TRACE_EVENT0("media", "WebMediaPlayerImpl:paint");
scoped_refptr<media::VideoFrame> video_frame = painter_.GetCurrentFrame(true);
+ if (video_frame &&
+ video_frame->format() == media::VideoFrame::NATIVE_TEXTURE) {
+ DCHECK(gpu_factories_);
+ gpu_factories_->WaitSyncPoint(video_frame->mailbox_holder()->sync_point);
+ }
gfx::Rect gfx_rect(rect);
skcanvas_video_renderer_.Paint(video_frame.get(), canvas, gfx_rect, alpha);
+ if (video_frame &&
+ video_frame->format() == media::VideoFrame::NATIVE_TEXTURE) {
+ DCHECK(gpu_factories_);
+ uint32 previous_sync_point =
+ video_frame->SwapReleaseSyncPoint(gpu_factories_->InsertSyncPoint());
+ if (previous_sync_point)
+ gpu_factories_->WaitSyncPoint(previous_sync_point);
+ }
}
bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const {
@@ -683,6 +696,10 @@ bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture(
// The flush() operation is not necessary here. It is kept since the
// performance will be better when it is added than not.
web_graphics_context->flush();
+ uint32 previous_sync_point = video_frame->SwapReleaseSyncPoint(
+ web_graphics_context->insertSyncPoint());
+ if (previous_sync_point)
+ web_graphics_context->waitSyncPoint(previous_sync_point);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698