| 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..ecb27e684afc18d5af4752ee921830e7c0ca17ac 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());
|
| }
|
| }
|
|
|
| + // Only configure opacity on changes, since marking it as transparent is
|
| + // expensive, see https://crbug.com/647886.
|
| + if (video_weblayer_ && last_frame_opaque_ != is_opaque) {
|
| + last_frame_opaque_ = is_opaque;
|
| + video_weblayer_->layer()->SetContentsOpaque(is_opaque);
|
| + }
|
| +
|
| compositor_->EnqueueFrame(frame);
|
| }
|
|
|
|
|