Chromium Code Reviews| Index: content/renderer/media/webmediaplayer_ms.cc |
| diff --git a/content/renderer/media/webmediaplayer_ms.cc b/content/renderer/media/webmediaplayer_ms.cc |
| index e60ae7681397c8591fd5c658d492284fa38547cb..c7468df60bfe48eb57c72ae7d3f0713132cfb0d7 100644 |
| --- a/content/renderer/media/webmediaplayer_ms.cc |
| +++ b/content/renderer/media/webmediaplayer_ms.cc |
| @@ -27,6 +27,7 @@ |
| #include "media/base/media_log.h" |
| #include "media/base/video_frame.h" |
| #include "media/base/video_rotation.h" |
| +#include "media/base/video_types.h" |
| #include "media/blink/webmediaplayer_util.h" |
| #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
| #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" |
| @@ -54,6 +55,7 @@ WebMediaPlayerMS::WebMediaPlayerMS( |
| client_(client), |
| delegate_(delegate), |
| delegate_id_(0), |
| + last_frame_opaque_(true), |
| paused_(true), |
| render_frame_suspended_(false), |
| received_first_frame_(false), |
| @@ -497,9 +499,11 @@ void WebMediaPlayerMS::OnFrameAvailable( |
| } else { |
| TRACE_EVENT0("webrtc", "WebMediaPlayerMS::OnFrameAvailable"); |
| } |
| + const bool is_opaque = media::IsOpaque(frame->format()); |
| if (!received_first_frame_) { |
| received_first_frame_ = true; |
| + last_frame_opaque_ = is_opaque; |
| SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); |
| SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); |
| @@ -509,12 +513,19 @@ void WebMediaPlayerMS::OnFrameAvailable( |
| video_weblayer_.reset(new cc_blink::WebLayerImpl( |
| cc::VideoLayer::Create(compositor_.get(), video_rotation_))); |
| - video_weblayer_->layer()->SetContentsOpaque(false); |
| + video_weblayer_->layer()->SetContentsOpaque(is_opaque); |
| video_weblayer_->SetContentsOpaqueIsFixed(true); |
| get_client()->setWebLayer(video_weblayer_.get()); |
| } |
| } |
| + // Change layer's transparency dynamically with incoming frames. |
|
mcasas
2016/09/20 00:35:14
Maybe add a comment here e.g.
"...only configure o
emircan
2016/09/20 03:00:06
Done.
|
| + if (video_frame_provider_.get() && video_weblayer_ && |
|
mcasas
2016/09/20 00:35:14
Isn't video_frame_provider_.get() redundant?
It is
emircan
2016/09/20 03:00:06
Done.
|
| + last_frame_opaque_ != is_opaque) { |
| + last_frame_opaque_ = is_opaque; |
| + video_weblayer_->layer()->SetContentsOpaque(is_opaque); |
| + } |
| + |
| compositor_->EnqueueFrame(frame); |
| } |