Chromium Code Reviews| Index: media/blink/webmediaplayer_impl.cc |
| diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc |
| index 52ee0e8e7cb426264f7b91c0169f9e6e99283dd1..0e19c536b7d456a0146e6728a891e686f0c89672 100644 |
| --- a/media/blink/webmediaplayer_impl.cc |
| +++ b/media/blink/webmediaplayer_impl.cc |
| @@ -61,6 +61,7 @@ |
| #include "third_party/WebKit/public/platform/WebSize.h" |
| #include "third_party/WebKit/public/platform/WebString.h" |
| #include "third_party/WebKit/public/platform/WebURL.h" |
| +#include "third_party/WebKit/public/platform/WebVideoSurfaceLayerBridge.h" |
| #include "third_party/WebKit/public/web/WebDocument.h" |
| #include "third_party/WebKit/public/web/WebFrame.h" |
| #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| @@ -251,6 +252,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( |
| is_encrypted_(false), |
| preroll_attempt_pending_(false), |
| observer_(params->media_observer()), |
| + bridge_( |
| + base::WrapUnique(blink::WebVideoSurfaceLayerBridge::Create(this))), |
|
liberato (no reviews please)
2017/06/26 22:39:30
maybe only do this if |kVideoSurface|?
CJ
2017/06/29 19:51:33
Done.
|
| max_keyframe_distance_to_disable_background_video_( |
| params->max_keyframe_distance_to_disable_background_video()), |
| max_keyframe_distance_to_disable_background_video_mse_( |
| @@ -323,7 +326,7 @@ WebMediaPlayerImpl::~WebMediaPlayerImpl() { |
| // Destruct compositor resources in the proper order. |
| client_->SetWebLayer(nullptr); |
| - if (video_weblayer_) |
| + if (video_weblayer_ && !base::FeatureList::IsEnabled(kVideoSurface)) |
| static_cast<cc::VideoLayer*>(video_weblayer_->layer())->StopUsingProvider(); |
| compositor_task_runner_->DeleteSoon(FROM_HERE, compositor_); |
| @@ -1349,8 +1352,12 @@ void WebMediaPlayerImpl::OnMetadata(PipelineMetadata metadata) { |
| } |
| DCHECK(!video_weblayer_); |
| - video_weblayer_.reset(new cc_blink::WebLayerImpl(cc::VideoLayer::Create( |
| - compositor_, pipeline_metadata_.video_rotation))); |
| + if (base::FeatureList::IsEnabled(media::kVideoSurface)) { |
| + video_weblayer_.reset(new cc_blink::WebLayerImpl(bridge_->GetLayer())); |
|
liberato (no reviews please)
2017/06/26 15:04:03
for your SurfaceLayer ownership question, i'd expe
enne (OOO)
2017/06/26 18:35:58
Yes, I think the same ownership model should apply
CJ
2017/06/29 19:51:33
So, to summarize, we want to pull out all SurfaceL
enne (OOO)
2017/06/29 20:29:29
I was suggesting that you don't need a bridge at a
CJ
2017/06/29 20:46:06
So, is this just a naming issue? (Sorry if I keep
|
| + } else { |
| + video_weblayer_.reset(new cc_blink::WebLayerImpl(cc::VideoLayer::Create( |
| + compositor_, pipeline_metadata_.video_rotation))); |
| + } |
| video_weblayer_->layer()->SetContentsOpaque(opaque_); |
| video_weblayer_->SetContentsOpaqueIsFixed(true); |
| client_->SetWebLayer(video_weblayer_.get()); |
| @@ -2383,6 +2390,8 @@ void WebMediaPlayerImpl::ActivateViewportIntersectionMonitoring(bool activate) { |
| client_->ActivateViewportIntersectionMonitoring(activate); |
| } |
| +void WebMediaPlayerImpl::OnWebLayerReplaced() {} |
| + |
| bool WebMediaPlayerImpl::ShouldPauseVideoWhenHidden() const { |
| // If suspending background video, pause any video that's not remoted or |
| // not unlocked to play in the background. |