| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "cc/layers/video_layer.h" | 13 #include "cc/layers/video_layer.h" |
| 14 #include "content/renderer/media/android/proxy_media_keys.h" | 14 #include "content/renderer/media/android/proxy_media_keys.h" |
| 15 #include "content/renderer/media/android/webmediaplayer_manager_android.h" | 15 #include "content/renderer/media/android/webmediaplayer_manager_android.h" |
| 16 #include "content/renderer/media/android/webmediaplayer_proxy_android.h" | 16 #include "content/renderer/media/android/webmediaplayer_proxy_android.h" |
| 17 #include "content/renderer/media/webmediaplayer_delegate.h" |
| 18 #include "content/renderer/media/webmediaplayer_util.h" |
| 17 #include "gpu/GLES2/gl2extchromium.h" | 19 #include "gpu/GLES2/gl2extchromium.h" |
| 18 #include "media/base/android/media_player_android.h" | 20 #include "media/base/android/media_player_android.h" |
| 19 #include "media/base/bind_to_loop.h" | 21 #include "media/base/bind_to_loop.h" |
| 20 #include "media/base/media_switches.h" | 22 #include "media/base/media_switches.h" |
| 21 #include "media/base/video_frame.h" | 23 #include "media/base/video_frame.h" |
| 22 #include "net/base/mime_util.h" | 24 #include "net/base/mime_util.h" |
| 23 #include "third_party/WebKit/public/platform/WebString.h" | 25 #include "third_party/WebKit/public/platform/WebString.h" |
| 24 #include "third_party/WebKit/public/web/WebDocument.h" | 26 #include "third_party/WebKit/public/web/WebDocument.h" |
| 25 #include "third_party/WebKit/public/web/WebFrame.h" | 27 #include "third_party/WebKit/public/web/WebFrame.h" |
| 26 #include "third_party/WebKit/public/web/WebMediaPlayerClient.h" | 28 #include "third_party/WebKit/public/web/WebMediaPlayerClient.h" |
| 27 #include "third_party/WebKit/public/web/WebMediaSource.h" | 29 #include "third_party/WebKit/public/web/WebMediaSource.h" |
| 28 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 30 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 29 #include "third_party/WebKit/public/web/WebView.h" | 31 #include "third_party/WebKit/public/web/WebView.h" |
| 30 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 32 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
| 31 #include "webkit/renderer/media/crypto/key_systems.h" | 33 #include "webkit/renderer/media/crypto/key_systems.h" |
| 32 #include "webkit/renderer/media/webmediaplayer_delegate.h" | |
| 33 #include "webkit/renderer/media/webmediaplayer_util.h" | |
| 34 | 34 |
| 35 #if defined(GOOGLE_TV) | 35 #if defined(GOOGLE_TV) |
| 36 #include "webkit/renderer/media/media_stream_audio_renderer.h" | 36 #include "content/public/renderer/media_stream_audio_renderer.h" |
| 37 #include "webkit/renderer/media/media_stream_client.h" | 37 #include "content/public/renderer/media_stream_client.h" |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 static const uint32 kGLTextureExternalOES = 0x8D65; | 40 static const uint32 kGLTextureExternalOES = 0x8D65; |
| 41 | 41 |
| 42 using WebKit::WebMediaPlayer; | 42 using WebKit::WebMediaPlayer; |
| 43 using WebKit::WebMediaSource; | 43 using WebKit::WebMediaSource; |
| 44 using WebKit::WebSize; | 44 using WebKit::WebSize; |
| 45 using WebKit::WebString; | 45 using WebKit::WebString; |
| 46 using WebKit::WebTimeRanges; | 46 using WebKit::WebTimeRanges; |
| 47 using WebKit::WebURL; | 47 using WebKit::WebURL; |
| 48 using media::MediaPlayerAndroid; | 48 using media::MediaPlayerAndroid; |
| 49 using media::VideoFrame; | 49 using media::VideoFrame; |
| 50 using webkit_media::ConvertSecondsToTimestamp; | |
| 51 using webkit_media::IsSupportedKeySystem; | |
| 52 using webkit_media::KeySystemNameForUMA; | |
| 53 using webkit_media::ProxyDecryptor; | |
| 54 using webkit_media::WebMediaPlayerDelegate; | |
| 55 | 50 |
| 56 namespace { | 51 namespace { |
| 57 // Prefix for histograms related to Encrypted Media Extensions. | 52 // Prefix for histograms related to Encrypted Media Extensions. |
| 58 const char* kMediaEme = "Media.EME."; | 53 const char* kMediaEme = "Media.EME."; |
| 59 } // namespace | 54 } // namespace |
| 60 | 55 |
| 61 namespace content { | 56 namespace content { |
| 62 | 57 |
| 63 #define BIND_TO_RENDER_LOOP(function) \ | 58 #define BIND_TO_RENDER_LOOP(function) \ |
| 64 media::BindToLoop(main_loop_, base::Bind(function, AsWeakPtr())) | 59 media::BindToLoop(main_loop_, base::Bind(function, AsWeakPtr())) |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 init_data_type_ = type; | 1126 init_data_type_ = type; |
| 1132 | 1127 |
| 1133 client_->keyNeeded(WebString(), | 1128 client_->keyNeeded(WebString(), |
| 1134 WebString::fromUTF8(session_id), | 1129 WebString::fromUTF8(session_id), |
| 1135 init_data.get(), | 1130 init_data.get(), |
| 1136 init_data_size); | 1131 init_data_size); |
| 1137 } | 1132 } |
| 1138 | 1133 |
| 1139 #if defined(GOOGLE_TV) | 1134 #if defined(GOOGLE_TV) |
| 1140 bool WebMediaPlayerAndroid::InjectMediaStream( | 1135 bool WebMediaPlayerAndroid::InjectMediaStream( |
| 1141 webkit_media::MediaStreamClient* media_stream_client, | 1136 MediaStreamClient* media_stream_client, |
| 1142 media::Demuxer* demuxer, | 1137 media::Demuxer* demuxer, |
| 1143 const base::Closure& destroy_demuxer_cb) { | 1138 const base::Closure& destroy_demuxer_cb) { |
| 1144 DCHECK(!demuxer); | 1139 DCHECK(!demuxer); |
| 1145 media_stream_client_ = media_stream_client; | 1140 media_stream_client_ = media_stream_client; |
| 1146 demuxer_ = demuxer; | 1141 demuxer_ = demuxer; |
| 1147 destroy_demuxer_cb_ = destroy_demuxer_cb; | 1142 destroy_demuxer_cb_ = destroy_demuxer_cb; |
| 1148 return true; | 1143 return true; |
| 1149 } | 1144 } |
| 1150 #endif | 1145 #endif |
| 1151 | 1146 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1165 | 1160 |
| 1166 void WebMediaPlayerAndroid::exitFullscreen() { | 1161 void WebMediaPlayerAndroid::exitFullscreen() { |
| 1167 proxy_->ExitFullscreen(player_id_); | 1162 proxy_->ExitFullscreen(player_id_); |
| 1168 } | 1163 } |
| 1169 | 1164 |
| 1170 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1165 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
| 1171 return manager_->CanEnterFullscreen(frame_); | 1166 return manager_->CanEnterFullscreen(frame_); |
| 1172 } | 1167 } |
| 1173 | 1168 |
| 1174 } // namespace content | 1169 } // namespace content |
| OLD | NEW |