| 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/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.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_helpers.h" | 10 #include "base/callback_helpers.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "cc/layers/video_layer.h" | 18 #include "cc/layers/video_layer.h" |
| 19 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
| 20 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
| 21 #include "content/public/renderer/render_frame.h" | 21 #include "content/public/renderer/render_frame.h" |
| 22 #include "content/renderer/compositor_bindings/web_layer_impl.h" |
| 22 #include "content/renderer/media/android/renderer_demuxer_android.h" | 23 #include "content/renderer/media/android/renderer_demuxer_android.h" |
| 23 #include "content/renderer/media/android/renderer_media_player_manager.h" | 24 #include "content/renderer/media/android/renderer_media_player_manager.h" |
| 24 #include "content/renderer/media/crypto/key_systems.h" | 25 #include "content/renderer/media/crypto/key_systems.h" |
| 25 #include "content/renderer/media/crypto/renderer_cdm_manager.h" | 26 #include "content/renderer/media/crypto/renderer_cdm_manager.h" |
| 26 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" | 27 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" |
| 27 #include "content/renderer/media/webmediaplayer_delegate.h" | 28 #include "content/renderer/media/webmediaplayer_delegate.h" |
| 28 #include "content/renderer/media/webmediaplayer_util.h" | 29 #include "content/renderer/media/webmediaplayer_util.h" |
| 29 #include "content/renderer/render_frame_impl.h" | 30 #include "content/renderer/render_frame_impl.h" |
| 30 #include "content/renderer/render_thread_impl.h" | 31 #include "content/renderer/render_thread_impl.h" |
| 31 #include "gpu/GLES2/gl2extchromium.h" | 32 #include "gpu/GLES2/gl2extchromium.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 44 #include "third_party/WebKit/public/web/WebDocument.h" | 45 #include "third_party/WebKit/public/web/WebDocument.h" |
| 45 #include "third_party/WebKit/public/web/WebFrame.h" | 46 #include "third_party/WebKit/public/web/WebFrame.h" |
| 46 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 47 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 47 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 48 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 48 #include "third_party/WebKit/public/web/WebView.h" | 49 #include "third_party/WebKit/public/web/WebView.h" |
| 49 #include "third_party/skia/include/core/SkBitmap.h" | 50 #include "third_party/skia/include/core/SkBitmap.h" |
| 50 #include "third_party/skia/include/core/SkCanvas.h" | 51 #include "third_party/skia/include/core/SkCanvas.h" |
| 51 #include "third_party/skia/include/core/SkPaint.h" | 52 #include "third_party/skia/include/core/SkPaint.h" |
| 52 #include "third_party/skia/include/core/SkTypeface.h" | 53 #include "third_party/skia/include/core/SkTypeface.h" |
| 53 #include "ui/gfx/image/image.h" | 54 #include "ui/gfx/image/image.h" |
| 54 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | |
| 55 | 55 |
| 56 static const uint32 kGLTextureExternalOES = 0x8D65; | 56 static const uint32 kGLTextureExternalOES = 0x8D65; |
| 57 | 57 |
| 58 using blink::WebMediaPlayer; | 58 using blink::WebMediaPlayer; |
| 59 using blink::WebSize; | 59 using blink::WebSize; |
| 60 using blink::WebString; | 60 using blink::WebString; |
| 61 using blink::WebTimeRanges; | 61 using blink::WebTimeRanges; |
| 62 using blink::WebURL; | 62 using blink::WebURL; |
| 63 using gpu::gles2::GLES2Interface; | 63 using gpu::gles2::GLES2Interface; |
| 64 using media::MediaPlayerAndroid; | 64 using media::MediaPlayerAndroid; |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 // previously called. | 720 // previously called. |
| 721 if (!paused() && needs_establish_peer_) | 721 if (!paused() && needs_establish_peer_) |
| 722 EstablishSurfaceTexturePeer(); | 722 EstablishSurfaceTexturePeer(); |
| 723 | 723 |
| 724 natural_size_.width = width; | 724 natural_size_.width = width; |
| 725 natural_size_.height = height; | 725 natural_size_.height = height; |
| 726 ReallocateVideoFrame(); | 726 ReallocateVideoFrame(); |
| 727 | 727 |
| 728 // Lazily allocate compositing layer. | 728 // Lazily allocate compositing layer. |
| 729 if (!video_weblayer_) { | 729 if (!video_weblayer_) { |
| 730 video_weblayer_.reset( | 730 video_weblayer_.reset(new WebLayerImpl(cc::VideoLayer::Create(this))); |
| 731 new webkit::WebLayerImpl(cc::VideoLayer::Create(this))); | |
| 732 client_->setWebLayer(video_weblayer_.get()); | 731 client_->setWebLayer(video_weblayer_.get()); |
| 733 } | 732 } |
| 734 | 733 |
| 735 // TODO(qinmin): This is a hack. We need the media element to stop showing the | 734 // TODO(qinmin): This is a hack. We need the media element to stop showing the |
| 736 // poster image by forcing it to call setDisplayMode(video). Should move the | 735 // poster image by forcing it to call setDisplayMode(video). Should move the |
| 737 // logic into HTMLMediaElement.cpp. | 736 // logic into HTMLMediaElement.cpp. |
| 738 client_->timeChanged(); | 737 client_->timeChanged(); |
| 739 } | 738 } |
| 740 | 739 |
| 741 void WebMediaPlayerAndroid::OnTimeUpdate(const base::TimeDelta& current_time) { | 740 void WebMediaPlayerAndroid::OnTimeUpdate(const base::TimeDelta& current_time) { |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 | 1562 |
| 1564 void WebMediaPlayerAndroid::exitFullscreen() { | 1563 void WebMediaPlayerAndroid::exitFullscreen() { |
| 1565 player_manager_->ExitFullscreen(player_id_); | 1564 player_manager_->ExitFullscreen(player_id_); |
| 1566 } | 1565 } |
| 1567 | 1566 |
| 1568 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1567 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
| 1569 return player_manager_->CanEnterFullscreen(frame_); | 1568 return player_manager_->CanEnterFullscreen(frame_); |
| 1570 } | 1569 } |
| 1571 | 1570 |
| 1572 } // namespace content | 1571 } // namespace content |
| OLD | NEW |