| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/webmediaplayer_ms.h" | 5 #include "content/renderer/media/webmediaplayer_ms.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "cc/layers/video_layer.h" | 13 #include "cc/layers/video_layer.h" |
| 14 #include "content/public/renderer/render_view.h" | 14 #include "content/public/renderer/render_view.h" |
| 15 #include "content/renderer/compositor_bindings/web_layer_impl.h" |
| 15 #include "content/renderer/media/media_stream_audio_renderer.h" | 16 #include "content/renderer/media/media_stream_audio_renderer.h" |
| 16 #include "content/renderer/media/media_stream_renderer_factory.h" | 17 #include "content/renderer/media/media_stream_renderer_factory.h" |
| 17 #include "content/renderer/media/video_frame_provider.h" | 18 #include "content/renderer/media/video_frame_provider.h" |
| 18 #include "content/renderer/media/webmediaplayer_delegate.h" | 19 #include "content/renderer/media/webmediaplayer_delegate.h" |
| 19 #include "content/renderer/media/webmediaplayer_util.h" | 20 #include "content/renderer/media/webmediaplayer_util.h" |
| 20 #include "content/renderer/render_frame_impl.h" | 21 #include "content/renderer/render_frame_impl.h" |
| 21 #include "media/base/media_log.h" | 22 #include "media/base/media_log.h" |
| 22 #include "media/base/video_frame.h" | 23 #include "media/base/video_frame.h" |
| 23 #include "media/base/video_util.h" | 24 #include "media/base/video_util.h" |
| 24 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 25 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
| 25 #include "third_party/WebKit/public/platform/WebRect.h" | 26 #include "third_party/WebKit/public/platform/WebRect.h" |
| 26 #include "third_party/WebKit/public/platform/WebSize.h" | 27 #include "third_party/WebKit/public/platform/WebSize.h" |
| 27 #include "third_party/WebKit/public/platform/WebURL.h" | 28 #include "third_party/WebKit/public/platform/WebURL.h" |
| 28 #include "third_party/WebKit/public/web/WebFrame.h" | 29 #include "third_party/WebKit/public/web/WebFrame.h" |
| 29 #include "third_party/WebKit/public/web/WebView.h" | 30 #include "third_party/WebKit/public/web/WebView.h" |
| 30 #include "third_party/skia/include/core/SkBitmap.h" | 31 #include "third_party/skia/include/core/SkBitmap.h" |
| 31 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | |
| 32 | 32 |
| 33 using blink::WebCanvas; | 33 using blink::WebCanvas; |
| 34 using blink::WebMediaPlayer; | 34 using blink::WebMediaPlayer; |
| 35 using blink::WebRect; | 35 using blink::WebRect; |
| 36 using blink::WebSize; | 36 using blink::WebSize; |
| 37 | 37 |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 // This function copies a YV12 or NATIVE_TEXTURE to a new YV12 | 40 // This function copies a YV12 or NATIVE_TEXTURE to a new YV12 |
| 41 // media::VideoFrame. | 41 // media::VideoFrame. |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 { | 407 { |
| 408 base::AutoLock auto_lock(current_frame_lock_); | 408 base::AutoLock auto_lock(current_frame_lock_); |
| 409 DCHECK(!current_frame_used_); | 409 DCHECK(!current_frame_used_); |
| 410 current_frame_ = frame; | 410 current_frame_ = frame; |
| 411 } | 411 } |
| 412 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); | 412 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); |
| 413 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); | 413 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); |
| 414 GetClient()->sizeChanged(); | 414 GetClient()->sizeChanged(); |
| 415 | 415 |
| 416 if (video_frame_provider_) { | 416 if (video_frame_provider_) { |
| 417 video_weblayer_.reset( | 417 video_weblayer_.reset(new WebLayerImpl(cc::VideoLayer::Create(this))); |
| 418 new webkit::WebLayerImpl(cc::VideoLayer::Create(this))); | |
| 419 video_weblayer_->setOpaque(true); | 418 video_weblayer_->setOpaque(true); |
| 420 GetClient()->setWebLayer(video_weblayer_.get()); | 419 GetClient()->setWebLayer(video_weblayer_.get()); |
| 421 } | 420 } |
| 422 } | 421 } |
| 423 | 422 |
| 424 // Do not update |current_frame_| when paused. | 423 // Do not update |current_frame_| when paused. |
| 425 if (paused_) | 424 if (paused_) |
| 426 return; | 425 return; |
| 427 | 426 |
| 428 bool size_changed = !current_frame_.get() || | 427 bool size_changed = !current_frame_.get() || |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 GetClient()->readyStateChanged(); | 469 GetClient()->readyStateChanged(); |
| 471 } | 470 } |
| 472 | 471 |
| 473 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { | 472 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { |
| 474 DCHECK(thread_checker_.CalledOnValidThread()); | 473 DCHECK(thread_checker_.CalledOnValidThread()); |
| 475 DCHECK(client_); | 474 DCHECK(client_); |
| 476 return client_; | 475 return client_; |
| 477 } | 476 } |
| 478 | 477 |
| 479 } // namespace content | 478 } // namespace content |
| OLD | NEW |