diff options
-rw-r--r-- | content/browser/android/child_process_launcher_android.cc | 6 | ||||
-rw-r--r-- | content/browser/android/content_video_view.cc | 18 | ||||
-rw-r--r-- | content/browser/android/media_player_manager_impl.cc | 52 | ||||
-rw-r--r-- | content/browser/android/media_player_manager_impl.h | 24 | ||||
-rw-r--r-- | content/browser/android/surface_texture_peer_browser_impl.cc | 6 | ||||
-rw-r--r-- | media/base/android/media_player_android.cc | 91 | ||||
-rw-r--r-- | media/base/android/media_player_android.h | 190 | ||||
-rw-r--r-- | media/base/android/media_player_bridge.cc | 94 | ||||
-rw-r--r-- | media/base/android/media_player_bridge.h | 186 | ||||
-rw-r--r-- | media/base/android/media_player_manager.h | 14 | ||||
-rw-r--r-- | media/media.gyp | 2 | ||||
-rw-r--r-- | webkit/media/android/webmediaplayer_android.cc | 12 | ||||
-rw-r--r-- | webkit/media/android/webmediaplayer_android.h | 2 | ||||
-rw-r--r-- | webkit/media/android/webmediaplayer_proxy_android.h | 2 |
14 files changed, 424 insertions, 275 deletions
diff --git a/content/browser/android/child_process_launcher_android.cc b/content/browser/android/child_process_launcher_android.cc index b3fb563..e14813a 100644 --- a/content/browser/android/child_process_launcher_android.cc +++ b/content/browser/android/child_process_launcher_android.cc @@ -14,7 +14,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "jni/ChildProcessLauncher_jni.h" -#include "media/base/android/media_player_bridge.h" +#include "media/base/android/media_player_android.h" #include "ui/gl/android/scoped_java_surface.h" using base::android::AttachCurrentThread; @@ -27,7 +27,7 @@ namespace content { namespace { -// Pass a java surface object to the MediaPlayerBridge object +// Pass a java surface object to the MediaPlayerAndroid object // identified by render process handle, render view ID and player ID. static void SetSurfacePeer( const base::android::JavaRef<jobject>& surface, @@ -48,7 +48,7 @@ static void SetSurfacePeer( RenderViewHostImpl* host = RenderViewHostImpl::FromID( renderer_id, render_view_id); if (host) { - media::MediaPlayerBridge* player = + media::MediaPlayerAndroid* player = host->media_player_manager()->GetPlayer(player_id); if (player && player != host->media_player_manager()->GetFullscreenPlayer()) { diff --git a/content/browser/android/content_video_view.cc b/content/browser/android/content_video_view.cc index 242134b..7f71cc4 100644 --- a/content/browser/android/content_video_view.cc +++ b/content/browser/android/content_video_view.cc @@ -87,27 +87,27 @@ void ContentVideoView::UpdateMediaMetadata() { } int ContentVideoView::GetVideoWidth(JNIEnv*, jobject obj) const { - media::MediaPlayerBridge* player = manager_->GetFullscreenPlayer(); + media::MediaPlayerAndroid* player = manager_->GetFullscreenPlayer(); return player ? player->GetVideoWidth() : 0; } int ContentVideoView::GetVideoHeight(JNIEnv*, jobject obj) const { - media::MediaPlayerBridge* player = manager_->GetFullscreenPlayer(); + media::MediaPlayerAndroid* player = manager_->GetFullscreenPlayer(); return player ? player->GetVideoHeight() : 0; } int ContentVideoView::GetDurationInMilliSeconds(JNIEnv*, jobject obj) const { - media::MediaPlayerBridge* player = manager_->GetFullscreenPlayer(); + media::MediaPlayerAndroid* player = manager_->GetFullscreenPlayer(); return player ? player->GetDuration().InMilliseconds() : -1; } int ContentVideoView::GetCurrentPosition(JNIEnv*, jobject obj) const { - media::MediaPlayerBridge* player = manager_->GetFullscreenPlayer(); + media::MediaPlayerAndroid* player = manager_->GetFullscreenPlayer(); return player ? player->GetCurrentTime().InMilliseconds() : 0; } bool ContentVideoView::IsPlaying(JNIEnv*, jobject obj) { - media::MediaPlayerBridge* player = manager_->GetFullscreenPlayer(); + media::MediaPlayerAndroid* player = manager_->GetFullscreenPlayer(); return player ? player->IsPlaying() : false; } @@ -135,12 +135,12 @@ void ContentVideoView::SetSurface(JNIEnv* env, jobject obj, } void ContentVideoView::UpdateMediaMetadata(JNIEnv* env, jobject obj) { - media::MediaPlayerBridge* player = manager_->GetFullscreenPlayer(); - if (player && player->prepared()) + media::MediaPlayerAndroid* player = manager_->GetFullscreenPlayer(); + if (player && player->IsPlayerReady()) Java_ContentVideoView_updateMediaMetadata( env, obj, player->GetVideoWidth(), player->GetVideoHeight(), - player->GetDuration().InMilliseconds(), player->can_pause(), - player->can_seek_forward(), player->can_seek_backward()); + player->GetDuration().InMilliseconds(), player->CanPause(), + player->CanSeekForward(), player->CanSeekBackward()); } } // namespace content diff --git a/content/browser/android/media_player_manager_impl.cc b/content/browser/android/media_player_manager_impl.cc index 30f11a4..2fe672d 100644 --- a/content/browser/android/media_player_manager_impl.cc +++ b/content/browser/android/media_player_manager_impl.cc @@ -13,7 +13,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/storage_partition.h" -using media::MediaPlayerBridge; +using media::MediaPlayerAndroid; // Threshold on the number of media players per renderer before we start // attempting to release inactive media players. @@ -59,7 +59,7 @@ bool MediaPlayerManagerImpl::OnMessageReceived(const IPC::Message& msg) { } void MediaPlayerManagerImpl::FullscreenPlayerPlay() { - MediaPlayerBridge* player = GetFullscreenPlayer(); + MediaPlayerAndroid* player = GetFullscreenPlayer(); if (player) { player->Start(); Send(new MediaPlayerMsg_DidMediaPlayerPlay( @@ -68,7 +68,7 @@ void MediaPlayerManagerImpl::FullscreenPlayerPlay() { } void MediaPlayerManagerImpl::FullscreenPlayerPause() { - MediaPlayerBridge* player = GetFullscreenPlayer(); + MediaPlayerAndroid* player = GetFullscreenPlayer(); if (player) { player->Pause(); Send(new MediaPlayerMsg_DidMediaPlayerPause( @@ -77,7 +77,7 @@ void MediaPlayerManagerImpl::FullscreenPlayerPause() { } void MediaPlayerManagerImpl::FullscreenPlayerSeek(int msec) { - MediaPlayerBridge* player = GetFullscreenPlayer(); + MediaPlayerAndroid* player = GetFullscreenPlayer(); if (player) player->SeekTo(base::TimeDelta::FromMilliseconds(msec)); } @@ -85,7 +85,7 @@ void MediaPlayerManagerImpl::FullscreenPlayerSeek(int msec) { void MediaPlayerManagerImpl::ExitFullscreen(bool release_media_player) { Send(new MediaPlayerMsg_DidExitFullscreen( routing_id(), fullscreen_player_id_)); - MediaPlayerBridge* player = GetFullscreenPlayer(); + MediaPlayerAndroid* player = GetFullscreenPlayer(); fullscreen_player_id_ = -1; if (!player) return; @@ -96,7 +96,7 @@ void MediaPlayerManagerImpl::ExitFullscreen(bool release_media_player) { } void MediaPlayerManagerImpl::SetVideoSurface(jobject surface) { - MediaPlayerBridge* player = GetFullscreenPlayer(); + MediaPlayerAndroid* player = GetFullscreenPlayer(); if (player) { player->SetVideoSurface(surface); Send(new MediaPlayerMsg_DidEnterFullscreen( @@ -108,7 +108,7 @@ void MediaPlayerManagerImpl::OnInitialize( int player_id, const GURL& url, bool is_media_source, const GURL& first_party_for_cookies) { - for (ScopedVector<MediaPlayerBridge>::iterator it = players_.begin(); + for (ScopedVector<MediaPlayerAndroid>::iterator it = players_.begin(); it != players_.end(); ++it) { if ((*it)->player_id() == player_id) { players_.erase(it); @@ -117,7 +117,7 @@ void MediaPlayerManagerImpl::OnInitialize( } RenderProcessHost* host = render_view_host()->GetProcess(); - players_.push_back(media::MediaPlayerBridge::Create( + players_.push_back(media::MediaPlayerAndroid::Create( player_id, url, is_media_source, first_party_for_cookies, host->GetBrowserContext()->IsOffTheRecord(), this, #if defined(GOOGLE_TV) @@ -155,19 +155,19 @@ media::MediaResourceGetter* MediaPlayerManagerImpl::GetMediaResourceGetter() { } void MediaPlayerManagerImpl::OnStart(int player_id) { - MediaPlayerBridge* player = GetPlayer(player_id); + MediaPlayerAndroid* player = GetPlayer(player_id); if (player) player->Start(); } void MediaPlayerManagerImpl::OnSeek(int player_id, base::TimeDelta time) { - MediaPlayerBridge* player = GetPlayer(player_id); + MediaPlayerAndroid* player = GetPlayer(player_id); if (player) player->SeekTo(time); } void MediaPlayerManagerImpl::OnPause(int player_id) { - MediaPlayerBridge* player = GetPlayer(player_id); + MediaPlayerAndroid* player = GetPlayer(player_id); if (player) player->Pause(); } @@ -181,7 +181,7 @@ void MediaPlayerManagerImpl::OnEnterFullscreen(int player_id) { void MediaPlayerManagerImpl::OnExitFullscreen(int player_id) { if (fullscreen_player_id_ == player_id) { - MediaPlayerBridge* player = GetPlayer(player_id); + MediaPlayerAndroid* player = GetPlayer(player_id); if (player) player->SetVideoSurface(NULL); video_view_.DestroyContentVideoView(); @@ -190,7 +190,7 @@ void MediaPlayerManagerImpl::OnExitFullscreen(int player_id) { } void MediaPlayerManagerImpl::OnReleaseResources(int player_id) { - MediaPlayerBridge* player = GetPlayer(player_id); + MediaPlayerAndroid* player = GetPlayer(player_id); // Don't release the fullscreen player when tab visibility changes, // it will be released when user hit the back/home button or when // OnDestroyPlayer is called. @@ -199,7 +199,7 @@ void MediaPlayerManagerImpl::OnReleaseResources(int player_id) { } void MediaPlayerManagerImpl::OnDestroyPlayer(int player_id) { - for (ScopedVector<MediaPlayerBridge>::iterator it = players_.begin(); + for (ScopedVector<MediaPlayerAndroid>::iterator it = players_.begin(); it != players_.end(); ++it) { if ((*it)->player_id() == player_id) { players_.erase(it); @@ -221,13 +221,13 @@ void MediaPlayerManagerImpl::DestroyAllMediaPlayers() { #if defined(GOOGLE_TV) void MediaPlayerManagerImpl::AttachExternalVideoSurface(int player_id, jobject surface) { - MediaPlayerBridge* player = GetPlayer(player_id); + MediaPlayerAndroid* player = GetPlayer(player_id); if (player) player->SetVideoSurface(surface); } void MediaPlayerManagerImpl::DetachExternalVideoSurface(int player_id) { - MediaPlayerBridge* player = GetPlayer(player_id); + MediaPlayerAndroid* player = GetPlayer(player_id); if (player) player->SetVideoSurface(NULL); } @@ -246,7 +246,7 @@ void MediaPlayerManagerImpl::OnNotifyExternalSurface( void MediaPlayerManagerImpl::OnDemuxerReady( int player_id, const media::MediaPlayerHostMsg_DemuxerReady_Params& params) { - MediaPlayerBridge* player = GetPlayer(player_id); + MediaPlayerAndroid* player = GetPlayer(player_id); if (player) player->DemuxerReady(params); } @@ -254,14 +254,14 @@ void MediaPlayerManagerImpl::OnDemuxerReady( void MediaPlayerManagerImpl::OnReadFromDemuxerAck( int player_id, const media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params) { - MediaPlayerBridge* player = GetPlayer(player_id); + MediaPlayerAndroid* player = GetPlayer(player_id); if (player) player->ReadFromDemuxerAck(params); } #endif -MediaPlayerBridge* MediaPlayerManagerImpl::GetPlayer(int player_id) { - for (ScopedVector<MediaPlayerBridge>::iterator it = players_.begin(); +MediaPlayerAndroid* MediaPlayerManagerImpl::GetPlayer(int player_id) { + for (ScopedVector<MediaPlayerAndroid>::iterator it = players_.begin(); it != players_.end(); ++it) { if ((*it)->player_id() == player_id) return *it; @@ -269,7 +269,7 @@ MediaPlayerBridge* MediaPlayerManagerImpl::GetPlayer(int player_id) { return NULL; } -MediaPlayerBridge* MediaPlayerManagerImpl::GetFullscreenPlayer() { +MediaPlayerAndroid* MediaPlayerManagerImpl::GetFullscreenPlayer() { return GetPlayer(fullscreen_player_id_); } @@ -337,14 +337,14 @@ void MediaPlayerManagerImpl::OnReadFromDemuxer( #endif void MediaPlayerManagerImpl::RequestMediaResources( - MediaPlayerBridge* player) { + MediaPlayerAndroid* player) { if (player == NULL) return; int num_active_player = 0; - ScopedVector<MediaPlayerBridge>::iterator it; + ScopedVector<MediaPlayerAndroid>::iterator it; for (it = players_.begin(); it != players_.end(); ++it) { - if (!(*it)->prepared()) + if (!(*it)->IsPlayerReady()) continue; // The player is already active, ignore it. @@ -359,7 +359,7 @@ void MediaPlayerManagerImpl::RequestMediaResources( return; for (it = players_.begin(); it != players_.end(); ++it) { - if ((*it)->prepared() && !(*it)->IsPlaying() && + if ((*it)->IsPlayerReady() && !(*it)->IsPlaying() && fullscreen_player_id_ != (*it)->player_id()) { (*it)->Release(); Send(new MediaPlayerMsg_MediaPlayerReleased( @@ -369,7 +369,7 @@ void MediaPlayerManagerImpl::RequestMediaResources( } void MediaPlayerManagerImpl::ReleaseMediaResources( - MediaPlayerBridge* player) { + MediaPlayerAndroid* player) { // Nothing needs to be done. } diff --git a/content/browser/android/media_player_manager_impl.h b/content/browser/android/media_player_manager_impl.h index 2cba3f6..61993b4 100644 --- a/content/browser/android/media_player_manager_impl.h +++ b/content/browser/android/media_player_manager_impl.h @@ -17,7 +17,7 @@ #if defined(GOOGLE_TV) #include "media/base/android/demuxer_stream_player_params.h" #endif -#include "media/base/android/media_player_bridge.h" +#include "media/base/android/media_player_android.h" #include "media/base/android/media_player_manager.h" #include "ui/gfx/rect_f.h" @@ -25,10 +25,10 @@ namespace content { class WebContents; -// This class manages all the MediaPlayerBridge objects. It receives +// This class manages all the MediaPlayerAndroid objects. It receives // control operations from the the render process, and forwards -// them to corresponding MediaPlayerBridge object. Callbacks from -// MediaPlayerBridge objects are converted to IPCs and then sent to the +// them to corresponding MediaPlayerAndroid object. Callbacks from +// MediaPlayerAndroid objects are converted to IPCs and then sent to the // render process. class MediaPlayerManagerImpl : public RenderViewHostObserver, @@ -52,7 +52,7 @@ class MediaPlayerManagerImpl // time update events. void OnTimeUpdate(int player_id, base::TimeDelta current_time); - // Callbacks needed by media::MediaPlayerBridge. + // Callbacks needed by media::MediaPlayerAndroid. void OnMediaMetadataChanged(int player_id, base::TimeDelta duration, int width, int height, bool success); void OnPlaybackComplete(int player_id); @@ -68,9 +68,11 @@ class MediaPlayerManagerImpl int player_id, media::DemuxerStream::Type type, bool seek_done); #endif - // media::MediaPlayerBridgeManager overrides. - virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE; - virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE; + // media::MediaPlayerManager overrides. + virtual void RequestMediaResources( + media::MediaPlayerAndroid* player) OVERRIDE; + virtual void ReleaseMediaResources( + media::MediaPlayerAndroid* player) OVERRIDE; virtual media::MediaResourceGetter* GetMediaResourceGetter() OVERRIDE; // Release all the players managed by this object. @@ -81,8 +83,8 @@ class MediaPlayerManagerImpl void DetachExternalVideoSurface(int player_id); #endif - media::MediaPlayerBridge* GetFullscreenPlayer(); - media::MediaPlayerBridge* GetPlayer(int player_id); + media::MediaPlayerAndroid* GetFullscreenPlayer(); + media::MediaPlayerAndroid* GetPlayer(int player_id); private: // Message handlers. @@ -108,7 +110,7 @@ class MediaPlayerManagerImpl #endif // An array of managed players. - ScopedVector<media::MediaPlayerBridge> players_; + ScopedVector<media::MediaPlayerAndroid> players_; // The fullscreen video view object. ContentVideoView video_view_; diff --git a/content/browser/android/surface_texture_peer_browser_impl.cc b/content/browser/android/surface_texture_peer_browser_impl.cc index 1cba847..fecc317 100644 --- a/content/browser/android/surface_texture_peer_browser_impl.cc +++ b/content/browser/android/surface_texture_peer_browser_impl.cc @@ -8,14 +8,14 @@ #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" -#include "media/base/android/media_player_bridge.h" +#include "media/base/android/media_player_android.h" #include "ui/gl/android/scoped_java_surface.h" namespace content { namespace { -// Pass a java surface object to the MediaPlayerBridge object +// Pass a java surface object to the MediaPlayerAndroid object // identified by render process handle, render view ID and player ID. static void SetSurfacePeer( scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge, @@ -36,7 +36,7 @@ static void SetSurfacePeer( RenderViewHostImpl* host = RenderViewHostImpl::FromID( renderer_id, render_view_id); if (host) { - media::MediaPlayerBridge* player = + media::MediaPlayerAndroid* player = host->media_player_manager()->GetPlayer(player_id); if (player && player != host->media_player_manager()->GetFullscreenPlayer()) { diff --git a/media/base/android/media_player_android.cc b/media/base/android/media_player_android.cc new file mode 100644 index 0000000..bd2ee9c --- /dev/null +++ b/media/base/android/media_player_android.cc @@ -0,0 +1,91 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "media/base/android/media_player_android.h" + +#include "media/base/android/media_player_manager.h" + +namespace media { + +MediaPlayerAndroid::MediaPlayerAndroid( + int player_id, + MediaPlayerManager* manager, + const MediaErrorCB& media_error_cb, + const VideoSizeChangedCB& video_size_changed_cb, + const BufferingUpdateCB& buffering_update_cb, + const MediaMetadataChangedCB& media_metadata_changed_cb, + const PlaybackCompleteCB& playback_complete_cb, + const SeekCompleteCB& seek_complete_cb, + const TimeUpdateCB& time_update_cb, + const MediaInterruptedCB& media_interrupted_cb) + : player_id_(player_id), + manager_(manager), + media_error_cb_(media_error_cb), + video_size_changed_cb_(video_size_changed_cb), + buffering_update_cb_(buffering_update_cb), + media_metadata_changed_cb_(media_metadata_changed_cb), + playback_complete_cb_(playback_complete_cb), + seek_complete_cb_(seek_complete_cb), + media_interrupted_cb_(media_interrupted_cb), + time_update_cb_(time_update_cb) { +} + +MediaPlayerAndroid::~MediaPlayerAndroid() {} + +void MediaPlayerAndroid::OnMediaError(int error_type) { + media_error_cb_.Run(player_id_, error_type); +} + +void MediaPlayerAndroid::OnVideoSizeChanged(int width, int height) { + video_size_changed_cb_.Run(player_id_, width, height); +} + +void MediaPlayerAndroid::OnBufferingUpdate(int percent) { + buffering_update_cb_.Run(player_id_, percent); +} + +void MediaPlayerAndroid::OnPlaybackComplete() { + playback_complete_cb_.Run(player_id_); +} + +void MediaPlayerAndroid::OnMediaInterrupted() { + media_interrupted_cb_.Run(player_id_); +} + +void MediaPlayerAndroid::OnSeekComplete() { + seek_complete_cb_.Run(player_id_, GetCurrentTime()); +} + +void MediaPlayerAndroid::OnTimeUpdated() { + time_update_cb_.Run(player_id_, GetCurrentTime()); +} + +void MediaPlayerAndroid::OnMediaMetadataChanged( + base::TimeDelta duration, int width, int height, bool success) { + media_metadata_changed_cb_.Run(player_id_, duration, width, height, success); +} + +void MediaPlayerAndroid::RequestMediaResourcesFromManager() { + if (manager_) + manager_->RequestMediaResources(this); +} + +void MediaPlayerAndroid::ReleaseMediaResourcesFromManager() { + if (manager_) + manager_->ReleaseMediaResources(this); +} + +#if defined(GOOGLE_TV) +void MediaPlayerAndroid::DemuxerReady( + const MediaPlayerHostMsg_DemuxerReady_Params& params) { + NOTREACHED() << "Unexpected ipc received"; +} + +void MediaPlayerAndroid::ReadFromDemuxerAck( + const MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params) { + NOTREACHED() << "Unexpected ipc received"; +} +#endif + +} // namespace media diff --git a/media/base/android/media_player_android.h b/media/base/android/media_player_android.h new file mode 100644 index 0000000..8dfe90c --- /dev/null +++ b/media/base/android/media_player_android.h @@ -0,0 +1,190 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ +#define MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ + +#include <jni.h> +#include <string> + +#include "base/callback.h" +#include "base/time.h" +#include "googleurl/src/gurl.h" +#include "media/base/media_export.h" + +#if defined(GOOGLE_TV) +#include "media/base/android/demuxer_stream_player_params.h" +#endif + +namespace media { + +class MediaPlayerManager; + +// This class serves as the base class for different media player +// implementations on Android. Subclasses need to provide their own +// MediaPlayerAndroid::Create() implementation. +class MEDIA_EXPORT MediaPlayerAndroid { + public: + virtual ~MediaPlayerAndroid(); + + // Error types for MediaErrorCB. + enum MediaErrorType { + MEDIA_ERROR_FORMAT, + MEDIA_ERROR_DECODE, + MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK, + MEDIA_ERROR_INVALID_CODE, + }; + + // Callback when error happens. Args: player ID, error type. + typedef base::Callback<void(int, int)> MediaErrorCB; + + // Callback when video size has changed. Args: player ID, width, height. + typedef base::Callback<void(int, int, int)> VideoSizeChangedCB; + + // Callback when buffering has changed. Args: player ID, percentage + // of the media. + typedef base::Callback<void(int, int)> BufferingUpdateCB; + + // Callback when media metadata changed. Args: player ID, duration of the + // media, width, height, whether the metadata is successfully extracted. + typedef base::Callback<void(int, base::TimeDelta, int, int, bool)> + MediaMetadataChangedCB; + + // Callbacks when seek completed. Args: player ID, current time. + typedef base::Callback<void(int, base::TimeDelta)> SeekCompleteCB; + + // Callbacks when seek completed. Args: player ID. + typedef base::Callback<void(int)> MediaInterruptedCB; + + // Callbacks when playback completed. Args: player ID. + typedef base::Callback<void(int)> PlaybackCompleteCB; + + // Callback when time update messages need to be sent. Args: player ID, + // current time. + typedef base::Callback<void(int, base::TimeDelta)> TimeUpdateCB; + +#if defined(GOOGLE_TV) + // Callback when DemuxerStreamPlayer wants to read data from the demuxer. + typedef base::Callback<void(int, DemuxerStream::Type, bool)> + ReadFromDemuxerCB; +#endif + + // Construct a MediaPlayerAndroid object with all the needed media player + // callbacks. This object needs to call |manager_|'s RequestMediaResources() + // before decoding the media stream. This allows |manager_| to track + // unused resources and free them when needed. On the other hand, it needs + // to call ReleaseMediaResources() when it is done with decoding. + static MediaPlayerAndroid* Create( + int player_id, + const GURL& url, + bool is_media_source, + const GURL& first_party_for_cookies, + bool hide_url_log, + MediaPlayerManager* manager, +#if defined(GOOGLE_TV) + const ReadFromDemuxerCB read_from_demuxer_cb, +#endif + const MediaErrorCB& media_error_cb, + const VideoSizeChangedCB& video_size_changed_cb, + const BufferingUpdateCB& buffering_update_cb, + const MediaMetadataChangedCB& media_metadata_changed_cb, + const PlaybackCompleteCB& playback_complete_cb, + const SeekCompleteCB& seek_complete_cb, + const TimeUpdateCB& time_update_cb, + const MediaInterruptedCB& media_interrupted_cb); + + // Passing an external java surface object to the player. + virtual void SetVideoSurface(jobject surface) = 0; + + // Start playing the media. + virtual void Start() = 0; + + // Pause the media. + virtual void Pause() = 0; + + // Seek to a particular position. When succeeds, OnSeekComplete() will be + // called. Otherwise, nothing will happen. + virtual void SeekTo(base::TimeDelta time) = 0; + + // Release the player resources. + virtual void Release() = 0; + + // Set the player volume. + virtual void SetVolume(float leftVolume, float rightVolume) = 0; + + // Get the media information from the player. + virtual int GetVideoWidth() = 0; + virtual int GetVideoHeight() = 0; + virtual base::TimeDelta GetDuration() = 0; + virtual base::TimeDelta GetCurrentTime() = 0; + virtual bool IsPlaying() = 0; + virtual bool IsPlayerReady() = 0; + virtual bool CanPause() = 0; + virtual bool CanSeekForward() = 0; + virtual bool CanSeekBackward() = 0; + +#if defined(GOOGLE_TV) + // Methods for DeumxerStreamPlayer. + // Informs DemuxerStreamPlayer that the demuxer is ready. + virtual void DemuxerReady( + const MediaPlayerHostMsg_DemuxerReady_Params& params); + // Called when the requested data is received from the demuxer. + virtual void ReadFromDemuxerAck( + const MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params); +#endif + + int player_id() { return player_id_; } + + protected: + MediaPlayerAndroid(int player_id, + MediaPlayerManager* manager, + const MediaErrorCB& media_error_cb, + const VideoSizeChangedCB& video_size_changed_cb, + const BufferingUpdateCB& buffering_update_cb, + const MediaMetadataChangedCB& media_metadata_changed_cb, + const PlaybackCompleteCB& playback_complete_cb, + const SeekCompleteCB& seek_complete_cb, + const TimeUpdateCB& time_update_cb, + const MediaInterruptedCB& media_interrupted_cb); + + // Called when player status changes. + virtual void OnMediaError(int error_type); + virtual void OnVideoSizeChanged(int width, int height); + virtual void OnBufferingUpdate(int percent); + virtual void OnPlaybackComplete(); + virtual void OnSeekComplete(); + virtual void OnMediaMetadataChanged( + base::TimeDelta duration, int width, int height, bool success); + virtual void OnMediaInterrupted(); + virtual void OnTimeUpdated(); + + // Request or release decoding resources from |manager_|. + virtual void RequestMediaResourcesFromManager(); + virtual void ReleaseMediaResourcesFromManager(); + + MediaPlayerManager* manager() { return manager_; } + + private: + // Player ID assigned to this player. + int player_id_; + + // Resource manager for all the media players. + MediaPlayerManager* manager_; + + // Callbacks when media player events are received. + MediaErrorCB media_error_cb_; + VideoSizeChangedCB video_size_changed_cb_; + BufferingUpdateCB buffering_update_cb_; + MediaMetadataChangedCB media_metadata_changed_cb_; + PlaybackCompleteCB playback_complete_cb_; + SeekCompleteCB seek_complete_cb_; + MediaInterruptedCB media_interrupted_cb_; + TimeUpdateCB time_update_cb_; + + DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); +}; + +} // namespace media + +#endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ diff --git a/media/base/android/media_player_bridge.cc b/media/base/android/media_player_bridge.cc index f08d3a75..3a45225 100644 --- a/media/base/android/media_player_bridge.cc +++ b/media/base/android/media_player_bridge.cc @@ -31,7 +31,7 @@ namespace media { #if !defined(GOOGLE_TV) // static -MediaPlayerBridge* MediaPlayerBridge::Create( +MediaPlayerAndroid* MediaPlayerAndroid::Create( int player_id, const GURL& url, bool is_media_source, @@ -78,15 +78,16 @@ MediaPlayerBridge::MediaPlayerBridge( const SeekCompleteCB& seek_complete_cb, const TimeUpdateCB& time_update_cb, const MediaInterruptedCB& media_interrupted_cb) - : media_error_cb_(media_error_cb), - video_size_changed_cb_(video_size_changed_cb), - buffering_update_cb_(buffering_update_cb), - media_metadata_changed_cb_(media_metadata_changed_cb), - playback_complete_cb_(playback_complete_cb), - seek_complete_cb_(seek_complete_cb), - media_interrupted_cb_(media_interrupted_cb), - time_update_cb_(time_update_cb), - player_id_(player_id), + : MediaPlayerAndroid(player_id, + manager, + media_error_cb, + video_size_changed_cb, + buffering_update_cb, + media_metadata_changed_cb, + playback_complete_cb, + seek_complete_cb, + time_update_cb, + media_interrupted_cb), prepared_(false), pending_play_(false), url_(url), @@ -98,7 +99,6 @@ MediaPlayerBridge::MediaPlayerBridge( can_pause_(true), can_seek_forward_(true), can_seek_backward_(true), - manager_(manager), weak_this_(this), listener_(base::MessageLoopProxy::current(), weak_this_.GetWeakPtr()) { @@ -117,7 +117,7 @@ void MediaPlayerBridge::Initialize() { } media::MediaResourceGetter* resource_getter = - manager_->GetMediaResourceGetter(); + manager()->GetMediaResourceGetter(); if (url_.SchemeIsFileSystem()) { cookies_.clear(); @@ -171,9 +171,9 @@ void MediaPlayerBridge::Prepare() { if (j_media_player_.is_null()) CreateMediaPlayer(); if (url_.SchemeIsFileSystem()) { - manager_->GetMediaResourceGetter()->GetPlatformPathFromFileSystemURL( - url_, base::Bind(&MediaPlayerBridge::SetDataSource, - weak_this_.GetWeakPtr())); + manager()->GetMediaResourceGetter()->GetPlatformPathFromFileSystemURL( + url_, base::Bind(&MediaPlayerBridge::SetDataSource, + weak_this_.GetWeakPtr())); } else { SetDataSource(url_.spec()); } @@ -201,7 +201,7 @@ void MediaPlayerBridge::SetDataSource(const std::string& url) { JNI_MediaPlayer::Java_MediaPlayer_prepareAsync( env, j_media_player_.obj()); } else { - media_error_cb_.Run(player_id_, MEDIA_ERROR_FORMAT); + OnMediaError(MEDIA_ERROR_FORMAT); } } @@ -211,7 +211,7 @@ void MediaPlayerBridge::OnCookiesRetrieved(const std::string& cookies) { } void MediaPlayerBridge::ExtractMediaMetadata(const std::string& url) { - manager_->GetMediaResourceGetter()->ExtractMediaMetadata( + manager()->GetMediaResourceGetter()->ExtractMediaMetadata( url, cookies_, base::Bind(&MediaPlayerBridge::OnMediaMetadataExtracted, weak_this_.GetWeakPtr())); } @@ -223,13 +223,7 @@ void MediaPlayerBridge::OnMediaMetadataExtracted( width_ = width; height_ = height; } - media_metadata_changed_cb_.Run(player_id_, duration_, width_, height_, - success); -} - -void MediaPlayerBridge::RequestMediaResourcesFromManager() { - if (manager_) - manager_->RequestMediaResources(this); + OnMediaMetadataChanged(duration_, width_, height_, success); } void MediaPlayerBridge::Start() { @@ -317,8 +311,6 @@ void MediaPlayerBridge::Release() { time_update_timer_.Stop(); if (prepared_) pending_seek_ = GetCurrentTime(); - if (manager_) - manager_->ReleaseMediaResources(this); prepared_ = false; pending_play_ = false; SetVideoSurface(NULL); @@ -326,7 +318,7 @@ void MediaPlayerBridge::Release() { JNIEnv* env = base::android::AttachCurrentThread(); JNI_MediaPlayer::Java_MediaPlayer_release(env, j_media_player_.obj()); j_media_player_.Reset(); - + ReleaseMediaResourcesFromManager(); listener_.ReleaseMediaPlayerListenerResources(); } @@ -340,38 +332,20 @@ void MediaPlayerBridge::SetVolume(float left_volume, float right_volume) { env, j_media_player_.obj(), left_volume, right_volume); } -void MediaPlayerBridge::DoTimeUpdate() { - base::TimeDelta current = GetCurrentTime(); - time_update_cb_.Run(player_id_, current); -} - -void MediaPlayerBridge::OnMediaError(int error_type) { - media_error_cb_.Run(player_id_, error_type); -} - void MediaPlayerBridge::OnVideoSizeChanged(int width, int height) { width_ = width; height_ = height; - video_size_changed_cb_.Run(player_id_, width, height); -} - -void MediaPlayerBridge::OnBufferingUpdate(int percent) { - buffering_update_cb_.Run(player_id_, percent); + MediaPlayerAndroid::OnVideoSizeChanged(width, height); } void MediaPlayerBridge::OnPlaybackComplete() { time_update_timer_.Stop(); - playback_complete_cb_.Run(player_id_); + MediaPlayerAndroid::OnPlaybackComplete(); } - void MediaPlayerBridge::OnMediaInterrupted() { time_update_timer_.Stop(); - media_interrupted_cb_.Run(player_id_); -} - -void MediaPlayerBridge::OnSeekComplete() { - seek_complete_cb_.Run(player_id_, GetCurrentTime()); + MediaPlayerAndroid::OnMediaInterrupted(); } void MediaPlayerBridge::OnMediaPrepared() { @@ -399,7 +373,7 @@ void MediaPlayerBridge::OnMediaPrepared() { } GetAllowedOperations(); - media_metadata_changed_cb_.Run(player_id_, duration_, width_, height_, true); + OnMediaMetadataChanged(duration_, width_, height_, true); } void MediaPlayerBridge::GetAllowedOperations() { @@ -422,7 +396,7 @@ void MediaPlayerBridge::StartInternal() { time_update_timer_.Start( FROM_HERE, base::TimeDelta::FromMilliseconds(kTimeUpdateInterval), - this, &MediaPlayerBridge::DoTimeUpdate); + this, &MediaPlayerBridge::OnTimeUpdated); } } @@ -453,16 +427,20 @@ bool MediaPlayerBridge::RegisterMediaPlayerBridge(JNIEnv* env) { return ret; } -#if defined(GOOGLE_TV) -void MediaPlayerBridge::DemuxerReady( - const MediaPlayerHostMsg_DemuxerReady_Params& params) { - NOTREACHED() << "Unexpected ipc received"; +bool MediaPlayerBridge::CanPause() { + return can_pause_; } -void MediaPlayerBridge::ReadFromDemuxerAck( - const MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params) { - NOTREACHED() << "Unexpected ipc received"; +bool MediaPlayerBridge::CanSeekForward() { + return can_seek_forward_; +} + +bool MediaPlayerBridge::CanSeekBackward() { + return can_seek_backward_; +} + +bool MediaPlayerBridge::IsPlayerReady() { + return prepared_; } -#endif } // namespace media diff --git a/media/base/android/media_player_bridge.h b/media/base/android/media_player_bridge.h index 6733ec6..7e9ba62 100644 --- a/media/base/android/media_player_bridge.h +++ b/media/base/android/media_player_bridge.h @@ -16,11 +16,9 @@ #include "base/time.h" #include "base/timer.h" #include "googleurl/src/gurl.h" -#include "media/base/media_export.h" -#if defined(GOOGLE_TV) -#include "media/base/android/demuxer_stream_player_params.h" -#endif +#include "media/base/android/media_player_android.h" #include "media/base/android/media_player_listener.h" +#include "media/base/media_export.h" namespace media { @@ -33,70 +31,10 @@ class MediaPlayerManager; // Pause(), SeekTo() gets called. As a result, media information may not // be available until one of those operations is performed. After that, we // will cache those information in case the mediaplayer gets released. -class MEDIA_EXPORT MediaPlayerBridge { +class MEDIA_EXPORT MediaPlayerBridge : public MediaPlayerAndroid { public: - // Error types for MediaErrorCB. - enum MediaErrorType { - MEDIA_ERROR_FORMAT, - MEDIA_ERROR_DECODE, - MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK, - MEDIA_ERROR_INVALID_CODE, - }; - - // Callback when error happens. Args: player ID, error type. - typedef base::Callback<void(int, int)> MediaErrorCB; - - // Callback when video size has changed. Args: player ID, width, height. - typedef base::Callback<void(int, int, int)> VideoSizeChangedCB; - - // Callback when buffering has changed. Args: player ID, percentage - // of the media. - typedef base::Callback<void(int, int)> BufferingUpdateCB; - - // Callback when player got prepared. Args: player ID, duration of the media. - typedef base::Callback<void(int, base::TimeDelta, int, int, bool)> - MediaMetadataChangedCB; - - // Callbacks when seek completed. Args: player ID, current time. - typedef base::Callback<void(int, base::TimeDelta)> SeekCompleteCB; - - // Callbacks when seek completed. Args: player ID - typedef base::Callback<void(int)> MediaInterruptedCB; - - // Callbacks when playback completed. Args: player ID. - typedef base::Callback<void(int)> PlaybackCompleteCB; - - // Callback when time update messages need to be sent. Args: player ID, - // current time. - typedef base::Callback<void(int, base::TimeDelta)> TimeUpdateCB; - -#if defined(GOOGLE_TV) - // Callback when DemuxerStreamPlayer wants to read data from the demuxer. - typedef base::Callback<void(int, DemuxerStream::Type, bool)> - ReadFromDemuxerCB; -#endif - static bool RegisterMediaPlayerBridge(JNIEnv* env); - static MediaPlayerBridge* Create( - int player_id, - const GURL& url, - bool is_media_source, - const GURL& first_party_for_cookies, - bool hide_url_log, - MediaPlayerManager* manager, -#if defined(GOOGLE_TV) - const ReadFromDemuxerCB read_from_demuxer_cb, -#endif - const MediaErrorCB& media_error_cb, - const VideoSizeChangedCB& video_size_changed_cb, - const BufferingUpdateCB& buffering_update_cb, - const MediaMetadataChangedCB& media_prepared_cb, - const PlaybackCompleteCB& playback_complete_cb, - const SeekCompleteCB& seek_complete_cb, - const TimeUpdateCB& time_update_cb, - const MediaInterruptedCB& media_interrupted_cb); - // Construct a MediaPlayerBridge object with all the needed media player // callbacks. This object needs to call |manager|'s RequestMediaResources() // before decoding the media stream. This allows |manager| to track @@ -117,81 +55,39 @@ class MEDIA_EXPORT MediaPlayerBridge { const MediaInterruptedCB& media_interrupted_cb); virtual ~MediaPlayerBridge(); - typedef std::map<std::string, std::string> HeadersMap; + // MediaPlayerAndroid implementation. + virtual void SetVideoSurface(jobject surface) OVERRIDE; + virtual void Start() OVERRIDE; + virtual void Pause() OVERRIDE; + virtual void SeekTo(base::TimeDelta time) OVERRIDE; + virtual void Release() OVERRIDE; + virtual void SetVolume(float leftVolume, float rightVolume) OVERRIDE; + virtual int GetVideoWidth() OVERRIDE; + virtual int GetVideoHeight() OVERRIDE; + virtual base::TimeDelta GetCurrentTime() OVERRIDE; + virtual base::TimeDelta GetDuration() OVERRIDE; + virtual bool IsPlaying() OVERRIDE; + virtual bool CanPause() OVERRIDE; + virtual bool CanSeekForward() OVERRIDE; + virtual bool CanSeekBackward() OVERRIDE; + virtual bool IsPlayerReady() OVERRIDE; - void SetVideoSurface(jobject surface); - - // Start playing the media. - void Start(); - - // Pause the media. - void Pause(); - - // Seek to a particular position. When succeeds, OnSeekComplete() will be - // called. Otherwise, nothing will happen. - void SeekTo(base::TimeDelta time); - - // Release the player resources. - virtual void Release(); - - // Set the player volume. - void SetVolume(float leftVolume, float rightVolume); - - // Get the media information from the player. - int GetVideoWidth(); - int GetVideoHeight(); - base::TimeDelta GetCurrentTime(); - base::TimeDelta GetDuration(); - bool IsPlaying(); + protected: + void SetMediaPlayer(jobject j_media_player); + void SetMediaPlayerListener(); - // Get allowed operations from the player. - void GetAllowedOperations(); + // MediaPlayerAndroid implementation. + virtual void OnVideoSizeChanged(int width, int height) OVERRIDE; + virtual void OnPlaybackComplete() OVERRIDE; + virtual void OnMediaInterrupted() OVERRIDE; -#if defined(GOOGLE_TV) - // Methods for DeumxerStreamPlayer. - // Informs DemuxerStreamPlayer that the demuxer is ready. - virtual void DemuxerReady( - const MediaPlayerHostMsg_DemuxerReady_Params& params); - // Called when the requested data is received from the demuxer. - virtual void ReadFromDemuxerAck( - const MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params); -#endif - - // Called by the timer to check for current time routinely and generates - // time update events. - void DoTimeUpdate(); - - // Called by the MediaPlayerListener and mirrored to corresponding - // callbacks. - void OnMediaError(int error_type); - void OnVideoSizeChanged(int width, int height); - void OnBufferingUpdate(int percent); - void OnPlaybackComplete(); - void OnSeekComplete(); - void OnMediaPrepared(); - void OnMediaInterrupted(); + virtual void PendingSeekInternal(base::TimeDelta time); // Prepare the player for playback, asynchronously. When succeeds, // OnMediaPrepared() will be called. Otherwise, OnMediaError() will // be called with an error type. virtual void Prepare(); - - // Callback function passed to |resource_getter_|. Called when the cookies - // are retrieved. - void OnCookiesRetrieved(const std::string& cookies); - - int player_id() { return player_id_; } - bool can_pause() { return can_pause_; } - bool can_seek_forward() { return can_seek_forward_; } - bool can_seek_backward() { return can_seek_backward_; } - bool prepared() { return prepared_; } - - protected: - void SetMediaPlayer(jobject j_media_player); - void SetMediaPlayerListener(); - void RequestMediaResourcesFromManager(); - - virtual void PendingSeekInternal(base::TimeDelta time); + void OnMediaPrepared(); private: // Initialize this object and extract the metadata from the media. @@ -208,27 +104,19 @@ class MEDIA_EXPORT MediaPlayerBridge { void PauseInternal(); void SeekInternal(base::TimeDelta time); + // Get allowed operations from the player. + void GetAllowedOperations(); + + // Callback function passed to |resource_getter_|. Called when the cookies + // are retrieved. + void OnCookiesRetrieved(const std::string& cookies); + // Extract the media metadata from a url, asynchronously. // OnMediaMetadataExtracted() will be called when this call finishes. void ExtractMediaMetadata(const std::string& url); void OnMediaMetadataExtracted(base::TimeDelta duration, int width, int height, bool success); - // Callbacks when events are received. - MediaErrorCB media_error_cb_; - VideoSizeChangedCB video_size_changed_cb_; - BufferingUpdateCB buffering_update_cb_; - MediaMetadataChangedCB media_metadata_changed_cb_; - PlaybackCompleteCB playback_complete_cb_; - SeekCompleteCB seek_complete_cb_; - MediaInterruptedCB media_interrupted_cb_; - - // Callbacks when timer events are received. - TimeUpdateCB time_update_cb_; - - // Player ID assigned to this player. - int player_id_; - // Whether the player is prepared for playback. bool prepared_; @@ -260,9 +148,6 @@ class MEDIA_EXPORT MediaPlayerBridge { // Cookies for |url_|. std::string cookies_; - // Resource manager for all the media players. - MediaPlayerManager* manager_; - // Java MediaPlayer instance. base::android::ScopedJavaGlobalRef<jobject> j_media_player_; @@ -274,6 +159,7 @@ class MEDIA_EXPORT MediaPlayerBridge { // Listener object that listens to all the media player events. MediaPlayerListener listener_; + friend class MediaPlayerListener; DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); }; diff --git a/media/base/android/media_player_manager.h b/media/base/android/media_player_manager.h index c4ae120..7d1abce 100644 --- a/media/base/android/media_player_manager.h +++ b/media/base/android/media_player_manager.h @@ -9,24 +9,24 @@ namespace media { -class MediaPlayerBridge; +class MediaPlayerAndroid; class MediaResourceGetter; -// This class is responsible for managing active MediaPlayerBridge objects. +// This class is responsible for managing active MediaPlayerAndroid objects. // It is implemented by content::MediaPlayerManagerImpl. class MEDIA_EXPORT MediaPlayerManager { public: virtual ~MediaPlayerManager(); - // Called by a MediaPlayerBridge object when it is going to decode + // Called by a MediaPlayerAndroid object when it is going to decode // media streams. This helps the manager object maintain an array - // of active MediaPlayerBridge objects and release the resources + // of active MediaPlayerAndroid objects and release the resources // when needed. - virtual void RequestMediaResources(MediaPlayerBridge* player) = 0; + virtual void RequestMediaResources(MediaPlayerAndroid* player) = 0; - // Called when a MediaPlayerBridge object releases all its decoding + // Called when a MediaPlayerAndroid object releases all its decoding // resources. - virtual void ReleaseMediaResources(MediaPlayerBridge* player) = 0; + virtual void ReleaseMediaResources(MediaPlayerAndroid* player) = 0; // Return a pointer to the MediaResourceGetter object. virtual MediaResourceGetter* GetMediaResourceGetter() = 0; diff --git a/media/media.gyp b/media/media.gyp index 557d118..d2dd550 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -1529,6 +1529,8 @@ 'base/android/media_codec_bridge.h', 'base/android/media_jni_registrar.cc', 'base/android/media_jni_registrar.h', + 'base/android/media_player_android.cc', + 'base/android/media_player_android.h', 'base/android/media_player_bridge.cc', 'base/android/media_player_bridge.h', 'base/android/media_player_listener.cc', diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc index 3edcbf7..da41718 100644 --- a/webkit/media/android/webmediaplayer_android.cc +++ b/webkit/media/android/webmediaplayer_android.cc @@ -10,7 +10,7 @@ #include "base/strings/string_number_conversions.h" #include "cc/layers/video_layer.h" #include "gpu/GLES2/gl2extchromium.h" -#include "media/base/android/media_player_bridge.h" +#include "media/base/android/media_player_android.h" #include "media/base/video_frame.h" #include "net/base/mime_util.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" @@ -37,7 +37,7 @@ using WebKit::WebSize; using WebKit::WebString; using WebKit::WebTimeRanges; using WebKit::WebURL; -using media::MediaPlayerBridge; +using media::MediaPlayerAndroid; using media::VideoFrame; namespace webkit_media { @@ -434,16 +434,16 @@ void WebMediaPlayerAndroid::OnSeekComplete(base::TimeDelta current_time) { void WebMediaPlayerAndroid::OnMediaError(int error_type) { switch (error_type) { - case MediaPlayerBridge::MEDIA_ERROR_FORMAT: + case MediaPlayerAndroid::MEDIA_ERROR_FORMAT: UpdateNetworkState(WebMediaPlayer::NetworkStateFormatError); break; - case MediaPlayerBridge::MEDIA_ERROR_DECODE: + case MediaPlayerAndroid::MEDIA_ERROR_DECODE: UpdateNetworkState(WebMediaPlayer::NetworkStateDecodeError); break; - case MediaPlayerBridge::MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: + case MediaPlayerAndroid::MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: UpdateNetworkState(WebMediaPlayer::NetworkStateFormatError); break; - case MediaPlayerBridge::MEDIA_ERROR_INVALID_CODE: + case MediaPlayerAndroid::MEDIA_ERROR_INVALID_CODE: break; } client_->repaint(); diff --git a/webkit/media/android/webmediaplayer_android.h b/webkit/media/android/webmediaplayer_android.h index e07d48f..a00c07d 100644 --- a/webkit/media/android/webmediaplayer_android.h +++ b/webkit/media/android/webmediaplayer_android.h @@ -53,7 +53,7 @@ class WebMediaPlayerAndroid public base::MessageLoop::DestructionObserver { public: // Construct a WebMediaPlayerAndroid object. This class communicates - // with the MediaPlayerBridge object in the browser process through + // with the MediaPlayerAndroid object in the browser process through // |proxy|. // TODO(qinmin): |frame| argument is used to determine whether the current // player can enter fullscreen. This logic should probably be moved into diff --git a/webkit/media/android/webmediaplayer_proxy_android.h b/webkit/media/android/webmediaplayer_proxy_android.h index a1c4277b..fd68410 100644 --- a/webkit/media/android/webmediaplayer_proxy_android.h +++ b/webkit/media/android/webmediaplayer_proxy_android.h @@ -23,7 +23,7 @@ class WebMediaPlayerProxyAndroid { public: virtual ~WebMediaPlayerProxyAndroid(); - // Initialize a MediaPlayerBridge object in browser process + // Initialize a MediaPlayerAndroid object in browser process virtual void Initialize(int player_id, const GURL& url, bool is_media_source, const GURL& first_party_for_cookies) = 0; |