| 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 { | 408 { |
| 409 base::AutoLock auto_lock(current_frame_lock_); | 409 base::AutoLock auto_lock(current_frame_lock_); |
| 410 DCHECK(!current_frame_used_); | 410 DCHECK(!current_frame_used_); |
| 411 current_frame_ = frame; | 411 current_frame_ = frame; |
| 412 } | 412 } |
| 413 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); | 413 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); |
| 414 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); | 414 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); |
| 415 GetClient()->sizeChanged(); | 415 GetClient()->sizeChanged(); |
| 416 | 416 |
| 417 if (video_frame_provider_) { | 417 if (video_frame_provider_) { |
| 418 video_weblayer_.reset( | 418 video_weblayer_.reset(new WebLayerImpl(cc::VideoLayer::Create(this))); |
| 419 new webkit::WebLayerImpl(cc::VideoLayer::Create(this))); | |
| 420 video_weblayer_->setOpaque(true); | 419 video_weblayer_->setOpaque(true); |
| 421 GetClient()->setWebLayer(video_weblayer_.get()); | 420 GetClient()->setWebLayer(video_weblayer_.get()); |
| 422 } | 421 } |
| 423 } | 422 } |
| 424 | 423 |
| 425 // Do not update |current_frame_| when paused. | 424 // Do not update |current_frame_| when paused. |
| 426 if (paused_) | 425 if (paused_) |
| 427 return; | 426 return; |
| 428 | 427 |
| 429 if (!sequence_started_) { | 428 if (!sequence_started_) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 GetClient()->readyStateChanged(); | 474 GetClient()->readyStateChanged(); |
| 476 } | 475 } |
| 477 | 476 |
| 478 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { | 477 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { |
| 479 DCHECK(thread_checker_.CalledOnValidThread()); | 478 DCHECK(thread_checker_.CalledOnValidThread()); |
| 480 DCHECK(client_); | 479 DCHECK(client_); |
| 481 return client_; | 480 return client_; |
| 482 } | 481 } |
| 483 | 482 |
| 484 } // namespace content | 483 } // namespace content |
| OLD | NEW |