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" |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1124 destination_url_gurl); | 1124 destination_url_gurl); |
1125 } | 1125 } |
1126 | 1126 |
1127 void WebMediaPlayerAndroid::OnMediaSourceOpened( | 1127 void WebMediaPlayerAndroid::OnMediaSourceOpened( |
1128 WebKit::WebMediaSourceNew* web_media_source) { | 1128 WebKit::WebMediaSourceNew* web_media_source) { |
1129 client_->mediaSourceOpened(web_media_source); | 1129 client_->mediaSourceOpened(web_media_source); |
1130 } | 1130 } |
1131 | 1131 |
1132 void WebMediaPlayerAndroid::OnNeedKey(const std::string& session_id, | 1132 void WebMediaPlayerAndroid::OnNeedKey(const std::string& session_id, |
1133 const std::string& type, | 1133 const std::string& type, |
1134 scoped_ptr<uint8[]> init_data, | 1134 const std::vector<uint8>& init_data) { |
1135 int init_data_size) { | |
1136 // Do not fire NeedKey event if encrypted media is not enabled. | 1135 // Do not fire NeedKey event if encrypted media is not enabled. |
1137 if (!WebKit::WebRuntimeFeatures::isEncryptedMediaEnabled() && | 1136 if (!WebKit::WebRuntimeFeatures::isEncryptedMediaEnabled() && |
1138 !WebKit::WebRuntimeFeatures::isLegacyEncryptedMediaEnabled()) { | 1137 !WebKit::WebRuntimeFeatures::isLegacyEncryptedMediaEnabled()) { |
1139 return; | 1138 return; |
1140 } | 1139 } |
1141 | 1140 |
1142 UMA_HISTOGRAM_COUNTS(kMediaEme + std::string("NeedKey"), 1); | 1141 UMA_HISTOGRAM_COUNTS(kMediaEme + std::string("NeedKey"), 1); |
1143 | 1142 |
1144 DCHECK(init_data_type_.empty() || type.empty() || type == init_data_type_); | 1143 DCHECK(init_data_type_.empty() || type.empty() || type == init_data_type_); |
1145 if (init_data_type_.empty()) | 1144 if (init_data_type_.empty()) |
1146 init_data_type_ = type; | 1145 init_data_type_ = type; |
1147 | 1146 |
1148 client_->keyNeeded(WebString(), | 1147 client_->keyNeeded(WebString(), |
1149 WebString::fromUTF8(session_id), | 1148 WebString::fromUTF8(session_id), |
1150 init_data.get(), | 1149 &init_data[0], |
xhwang
2013/08/23 17:24:37
Is it possible that init_data.empty()? It'll crash
acolwell GONE FROM CHROMIUM
2013/08/23 19:55:28
Done.
| |
1151 init_data_size); | 1150 init_data.size()); |
1152 } | 1151 } |
1153 | 1152 |
1154 #if defined(GOOGLE_TV) | 1153 #if defined(GOOGLE_TV) |
1155 bool WebMediaPlayerAndroid::InjectMediaStream( | 1154 bool WebMediaPlayerAndroid::InjectMediaStream( |
1156 MediaStreamClient* media_stream_client, | 1155 MediaStreamClient* media_stream_client, |
1157 media::Demuxer* demuxer, | 1156 media::Demuxer* demuxer, |
1158 const base::Closure& destroy_demuxer_cb) { | 1157 const base::Closure& destroy_demuxer_cb) { |
1159 DCHECK(!demuxer); | 1158 DCHECK(!demuxer); |
1160 media_stream_client_ = media_stream_client; | 1159 media_stream_client_ = media_stream_client; |
1161 demuxer_ = demuxer; | 1160 demuxer_ = demuxer; |
(...skipping 18 matching lines...) Expand all Loading... | |
1180 | 1179 |
1181 void WebMediaPlayerAndroid::exitFullscreen() { | 1180 void WebMediaPlayerAndroid::exitFullscreen() { |
1182 proxy_->ExitFullscreen(player_id_); | 1181 proxy_->ExitFullscreen(player_id_); |
1183 } | 1182 } |
1184 | 1183 |
1185 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1184 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
1186 return manager_->CanEnterFullscreen(frame_); | 1185 return manager_->CanEnterFullscreen(frame_); |
1187 } | 1186 } |
1188 | 1187 |
1189 } // namespace content | 1188 } // namespace content |
OLD | NEW |