| 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..74dce56f0c0b6b3fc5be1a668014114dde938471 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,17 @@ 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 ? 0 : MediaPlayerBridge::FLAG_MEDIA_SOURCE);
|
| +}
|
| +
|
| +void WebMediaPlayerAndroid::InitializeMediaPlayer(const WebURL& url,
|
| + int flags) {
|
| 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, flags, first_party_url);
|
| if (manager_->IsInFullscreen(frame_))
|
| proxy_->EnterFullscreen(player_id_);
|
| }
|
| @@ -137,13 +125,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 +144,6 @@ void WebMediaPlayerAndroid::seek(double seconds) {
|
| seeking_ = true;
|
|
|
| base::TimeDelta seek_time = ConvertSecondsToTimestamp(seconds);
|
| -#if defined(GOOGLE_TV)
|
| - if (media_source_delegate_)
|
| - media_source_delegate_->Seek(seek_time);
|
| -#endif
|
| if (proxy_)
|
| proxy_->Seek(player_id_, seek_time);
|
| }
|
| @@ -262,10 +239,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 +319,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 +411,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 +510,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 +542,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 +589,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 +607,20 @@ 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;
|
| +}
|
| +
|
| +WebMediaPlayerProxyAndroid* WebMediaPlayerAndroid::proxy() { return proxy_; }
|
| +WebKit::WebFrame* WebMediaPlayerAndroid::frame() { return frame_; }
|
| +WebKit::WebMediaPlayerClient* WebMediaPlayerAndroid::client() {
|
| + return client_;
|
| +}
|
| +int WebMediaPlayerAndroid::player_id() { return player_id_; }
|
| +
|
| } // namespace webkit_media
|
|
|