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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 init_data_type_ = type; | 1109 init_data_type_ = type; |
1115 | 1110 |
1116 client_->keyNeeded(WebString(), | 1111 client_->keyNeeded(WebString(), |
1117 WebString::fromUTF8(session_id), | 1112 WebString::fromUTF8(session_id), |
1118 init_data.get(), | 1113 init_data.get(), |
1119 init_data_size); | 1114 init_data_size); |
1120 } | 1115 } |
1121 | 1116 |
1122 #if defined(GOOGLE_TV) | 1117 #if defined(GOOGLE_TV) |
1123 bool WebMediaPlayerAndroid::InjectMediaStream( | 1118 bool WebMediaPlayerAndroid::InjectMediaStream( |
1124 webkit_media::MediaStreamClient* media_stream_client, | 1119 MediaStreamClient* media_stream_client, |
1125 media::Demuxer* demuxer, | 1120 media::Demuxer* demuxer, |
1126 const base::Closure& destroy_demuxer_cb) { | 1121 const base::Closure& destroy_demuxer_cb) { |
1127 DCHECK(!demuxer); | 1122 DCHECK(!demuxer); |
1128 media_stream_client_ = media_stream_client; | 1123 media_stream_client_ = media_stream_client; |
1129 demuxer_ = demuxer; | 1124 demuxer_ = demuxer; |
1130 destroy_demuxer_cb_ = destroy_demuxer_cb; | 1125 destroy_demuxer_cb_ = destroy_demuxer_cb; |
1131 return true; | 1126 return true; |
1132 } | 1127 } |
1133 #endif | 1128 #endif |
1134 | 1129 |
(...skipping 13 matching lines...) Expand all Loading... |
1148 | 1143 |
1149 void WebMediaPlayerAndroid::exitFullscreen() { | 1144 void WebMediaPlayerAndroid::exitFullscreen() { |
1150 proxy_->ExitFullscreen(player_id_); | 1145 proxy_->ExitFullscreen(player_id_); |
1151 } | 1146 } |
1152 | 1147 |
1153 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1148 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
1154 return manager_->CanEnterFullscreen(frame_); | 1149 return manager_->CanEnterFullscreen(frame_); |
1155 } | 1150 } |
1156 | 1151 |
1157 } // namespace content | 1152 } // namespace content |
OLD | NEW |