Index: webkit/media/android/webmediaplayer_android.cc |
diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc |
index 7907512455e0e5b6df6a52541cd88f92d6843774..6b99f51e4733c0ac700ad7e5d44cff98cb877783 100644 |
--- a/webkit/media/android/webmediaplayer_android.cc |
+++ b/webkit/media/android/webmediaplayer_android.cc |
@@ -25,10 +25,6 @@ |
#include "webkit/media/media_switches.h" |
#include "webkit/media/webmediaplayer_util.h" |
-#if defined(GOOGLE_TV) |
-#include "webkit/media/android/media_source_delegate.h" |
-#endif |
- |
static const uint32 kGLTextureExternalOES = 0x8D65; |
using WebKit::WebMediaPlayer; |
@@ -47,8 +43,7 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid( |
WebKit::WebMediaPlayerClient* client, |
WebMediaPlayerManagerAndroid* manager, |
WebMediaPlayerProxyAndroid* proxy, |
- StreamTextureFactory* factory, |
- media::MediaLog* media_log) |
+ StreamTextureFactory* factory) |
: frame_(frame), |
client_(client), |
buffered_(1u), |
@@ -66,8 +61,7 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid( |
needs_external_surface_(false), |
video_frame_provider_client_(NULL), |
proxy_(proxy), |
- current_time_(0), |
- media_log_(media_log) { |
+ current_time_(0) { |
main_loop_->AddDestructionObserver(this); |
if (manager_) |
player_id_ = manager_->RegisterMediaPlayer(this); |
@@ -107,23 +101,21 @@ void WebMediaPlayerAndroid::load(const WebURL& url, |
NOTIMPLEMENTED() << "No CORS support"; |
scoped_ptr<WebKit::WebMediaSource> scoped_media_source(media_source); |
-#if defined(GOOGLE_TV) |
- if (media_source) { |
- media_source_delegate_.reset( |
- new MediaSourceDelegate( |
- frame_, client_, proxy_, player_id_, media_log_)); |
- // |media_source_delegate_| is owned, so Unretained() is safe here. |
- media_source_delegate_->Initialize( |
- scoped_media_source.Pass(), |
- base::Bind(&WebMediaPlayerAndroid::UpdateNetworkState, |
- base::Unretained(this))); |
- } |
-#endif |
+ InitializeMediaPlayer( |
+ url, |
+ media_source == NULL |
+ ? MediaPlayerBridge::MEDIA_TYPE_DEFAULT |
+ : MediaPlayerBridge::MEDIA_TYPE_MEDIA_SOURCE_EXTENSIONS); |
+} |
+ |
+void WebMediaPlayerAndroid::InitializeMediaPlayer( |
+ const WebURL& url, |
+ MediaPlayerBridge::MediaType media_type) { |
url_ = url; |
GURL first_party_url = frame_->document().firstPartyForCookies(); |
if (proxy_) { |
- proxy_->Initialize(player_id_, url_, media_source != NULL, first_party_url); |
+ proxy_->Initialize(player_id_, url, media_type, first_party_url); |
if (manager_->IsInFullscreen(frame_)) |
proxy_->EnterFullscreen(player_id_); |
} |
@@ -137,13 +129,6 @@ void WebMediaPlayerAndroid::cancelLoad() { |
} |
void WebMediaPlayerAndroid::play() { |
-#if defined(GOOGLE_TV) |
- if (hasVideo() && needs_external_surface_) { |
- DCHECK(!needs_establish_peer_); |
- if (proxy_) |
- proxy_->RequestExternalSurface(player_id_); |
- } |
-#endif |
if (hasVideo() && needs_establish_peer_) |
EstablishSurfaceTexturePeer(); |
@@ -163,10 +148,6 @@ void WebMediaPlayerAndroid::seek(double seconds) { |
seeking_ = true; |
base::TimeDelta seek_time = ConvertSecondsToTimestamp(seconds); |
-#if defined(GOOGLE_TV) |
- if (media_source_delegate_) |
acolwell GONE FROM CHROMIUM
2013/05/01 14:34:28
If the goal of most of the changes in this file ar
wonsik
2013/05/02 15:22:00
Done.
|
- media_source_delegate_->Seek(seek_time); |
-#endif |
if (proxy_) |
proxy_->Seek(player_id_, seek_time); |
} |
@@ -262,10 +243,6 @@ WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { |
} |
const WebTimeRanges& WebMediaPlayerAndroid::buffered() { |
-#if defined(GOOGLE_TV) |
- if (media_source_delegate_) |
- return media_source_delegate_->Buffered(); |
-#endif |
return buffered_; |
} |
@@ -346,37 +323,21 @@ double WebMediaPlayerAndroid::mediaTimeForTimeValue(double timeValue) const { |
} |
unsigned WebMediaPlayerAndroid::decodedFrameCount() const { |
-#if defined(GOOGLE_TV) |
- if (media_source_delegate_) |
- return media_source_delegate_->DecodedFrameCount(); |
-#endif |
NOTIMPLEMENTED(); |
return 0; |
} |
unsigned WebMediaPlayerAndroid::droppedFrameCount() const { |
-#if defined(GOOGLE_TV) |
- if (media_source_delegate_) |
- return media_source_delegate_->DroppedFrameCount(); |
-#endif |
NOTIMPLEMENTED(); |
return 0; |
} |
unsigned WebMediaPlayerAndroid::audioDecodedByteCount() const { |
-#if defined(GOOGLE_TV) |
- if (media_source_delegate_) |
- return media_source_delegate_->AudioDecodedByteCount(); |
-#endif |
NOTIMPLEMENTED(); |
return 0; |
} |
unsigned WebMediaPlayerAndroid::videoDecodedByteCount() const { |
-#if defined(GOOGLE_TV) |
- if (media_source_delegate_) |
- return media_source_delegate_->VideoDecodedByteCount(); |
-#endif |
NOTIMPLEMENTED(); |
return 0; |
} |
@@ -454,27 +415,6 @@ void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) { |
if (natural_size_.width == width && natural_size_.height == height) |
return; |
-#if defined(GOOGLE_TV) |
- static bool has_switch = CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kUseExternalVideoSurfaceThresholdInPixels); |
- static int threshold = 0; |
- static bool parsed_arg = |
- has_switch && |
- base::StringToInt( |
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
- switches::kUseExternalVideoSurfaceThresholdInPixels), |
- &threshold); |
- |
- if ((parsed_arg && threshold <= width * height) || |
- // Use H/W surface for MSE as the content is protected. |
- media_source_delegate_) { |
- needs_external_surface_ = true; |
- SetNeedsEstablishPeer(false); |
- if (!paused() && proxy_) |
- proxy_->RequestExternalSurface(player_id_); |
- } |
-#endif |
- |
natural_size_.width = width; |
natural_size_.height = height; |
ReallocateVideoFrame(); |
@@ -574,7 +514,7 @@ void WebMediaPlayerAndroid::Detach() { |
} |
void WebMediaPlayerAndroid::ReallocateVideoFrame() { |
- if (needs_external_surface_) { |
+ if (NeedsExternalSurface()) { |
// VideoFrame::CreateHoleFrame is only defined under GOOGLE_TV. |
#if defined(GOOGLE_TV) |
if (!natural_size_.isEmpty()) |
@@ -606,7 +546,7 @@ void WebMediaPlayerAndroid::SetVideoFrameProviderClient( |
scoped_refptr<media::VideoFrame> WebMediaPlayerAndroid::GetCurrentFrame() { |
if (stream_texture_proxy_ && !stream_texture_proxy_->IsBoundToThread() && |
- stream_id_ && !needs_external_surface_) { |
+ stream_id_ && !NeedsExternalSurface()) { |
gfx::Size natural_size = current_frame_->natural_size(); |
stream_texture_proxy_->BindToCurrentThread( |
stream_id_, natural_size.width(), natural_size.height()); |
@@ -653,47 +593,6 @@ bool WebMediaPlayerAndroid::RetrieveGeometryChange(gfx::RectF* rect) { |
last_computed_rect_ = *rect; |
return true; |
} |
- |
-WebMediaPlayer::MediaKeyException |
-WebMediaPlayerAndroid::generateKeyRequest(const WebString& key_system, |
- const unsigned char* init_data, |
- unsigned init_data_length) { |
- if (media_source_delegate_) { |
- return media_source_delegate_->GenerateKeyRequest( |
- key_system, init_data, init_data_length); |
- } |
- return MediaKeyExceptionKeySystemNotSupported; |
-} |
- |
-WebMediaPlayer::MediaKeyException WebMediaPlayerAndroid::addKey( |
- const WebString& key_system, |
- const unsigned char* key, |
- unsigned key_length, |
- const unsigned char* init_data, |
- unsigned init_data_length, |
- const WebString& session_id) { |
- if (media_source_delegate_) { |
- return media_source_delegate_->AddKey( |
- key_system, key, key_length, init_data, init_data_length, session_id); |
- } |
- return MediaKeyExceptionKeySystemNotSupported; |
-} |
- |
-WebMediaPlayer::MediaKeyException WebMediaPlayerAndroid::cancelKeyRequest( |
- const WebString& key_system, |
- const WebString& session_id) { |
- if (media_source_delegate_) |
- return media_source_delegate_->CancelKeyRequest(key_system, session_id); |
- return MediaKeyExceptionKeySystemNotSupported; |
-} |
- |
-void WebMediaPlayerAndroid::OnReadFromDemuxer( |
- media::DemuxerStream::Type type, bool seek_done) { |
- if (media_source_delegate_) |
- media_source_delegate_->OnReadFromDemuxer(type, seek_done); |
- else |
- NOTIMPLEMENTED(); |
-} |
#endif |
void WebMediaPlayerAndroid::enterFullscreen() { |
@@ -712,4 +611,13 @@ bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
return manager_->CanEnterFullscreen(frame_); |
} |
+bool WebMediaPlayerAndroid::NeedsExternalSurface() { |
+ return needs_external_surface_; |
+} |
+ |
+void WebMediaPlayerAndroid::SetNeedsExternalSurface( |
+ bool needs_external_surface) { |
+ needs_external_surface_ = needs_external_surface; |
+} |
+ |
} // namespace webkit_media |