Index: media/blink/webmediaplayer_impl.h |
diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h |
index d97a0b4c4a5429f5b1e8be09ced5e34e0600c9eb..4060e03a76a82be1dd7d5180fab829de1698a1c5 100644 |
--- a/media/blink/webmediaplayer_impl.h |
+++ b/media/blink/webmediaplayer_impl.h |
@@ -36,6 +36,17 @@ |
#include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
#include "url/gurl.h" |
+#if defined(OS_ANDROID) |
+// Use WIMPI_CAST instead of OS_ANDROID to clearly mark the cast implementation |
+// so that we can easily remove it later, see crbug/575276. |
+#define WIMPI_CAST |
DaleCurtis
2016/01/07 19:59:32
Can we avoid setting this here. #define in header
hubbe
2016/01/07 20:31:03
Hmm, so where should it go then?
I see two possib
DaleCurtis
2016/01/07 21:28:39
I'd just use OS_ANDROID with a // WMPI_CAST commen
hubbe
2016/01/11 22:47:24
Done.
|
+#endif |
+ |
+#if defined(WIMPI_CAST) |
+// Delete this file when WIMPI_CAST is no longer needed. |
+#include "media/blink/renderer_media_player_interface.h" |
+#endif |
+ |
namespace blink { |
class WebGraphicsContext3D; |
class WebLocalFrame; |
@@ -70,6 +81,9 @@ class WebTextTrackImpl; |
class MEDIA_BLINK_EXPORT WebMediaPlayerImpl |
: public NON_EXPORTED_BASE(blink::WebMediaPlayer), |
public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), |
+#if defined(WIMPI_CAST) |
+ public RendererMediaPlayerInterface, |
+#endif |
public base::SupportsWeakPtr<WebMediaPlayerImpl> { |
public: |
// Constructs a WebMediaPlayer implementation using Chromium's media stack. |
@@ -190,6 +204,64 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl |
void OnHidden() override; |
void OnShown() override; |
+#if defined(WIMPI_CAST) |
DaleCurtis
2016/01/07 19:59:32
Can you stick this all in another class instead th
hubbe
2016/01/07 20:31:03
It's not a simple thing to do.
Some of these metho
DaleCurtis
2016/01/07 21:28:40
Please give it some more thought. You're essential
DaleCurtis
2016/01/07 21:29:09
s/900/400/
liberato (no reviews please)
2016/01/08 16:37:58
many of the operations these things perform are on
hubbe
2016/01/11 22:47:24
I think it might turn out messy, but I'm not sure.
|
+ void requestRemotePlayback() override; |
+ void requestRemotePlaybackControl() override; |
+ |
+ void set_media_player_manager( |
+ RendererMediaPlayerManagerInterface* media_player_manager); |
+ |
+ // RendererMediaPlayerInterface implementation |
+ void OnMediaMetadataChanged(base::TimeDelta duration, |
+ int width, |
+ int height, |
+ bool success) override; |
+ void OnPlaybackComplete() override; |
+ void OnBufferingUpdate(int percentage) override; |
+ void OnSeekRequest(const base::TimeDelta& time_to_seek) override; |
+ void OnSeekComplete(const base::TimeDelta& current_time) override; |
+ void OnMediaError(int error_type) override; |
+ void OnVideoSizeChanged(int width, int height) override; |
+ |
+ // Called to update the current time. |
+ void OnTimeUpdate(base::TimeDelta current_timestamp, |
+ base::TimeTicks current_time_ticks) override; |
+ |
+ // void OnWaitingForDecryptionKey() override; |
+ void OnPlayerReleased() override; |
+ |
+ // Functions called when media player status changes. |
+ void OnConnectedToRemoteDevice( |
+ const std::string& remote_playback_message) override; |
+ void OnDisconnectedFromRemoteDevice() override; |
+ void OnDidExitFullscreen() override; |
+ void OnMediaPlayerPlay() override; |
+ void OnMediaPlayerPause() override; |
+ void OnRemoteRouteAvailabilityChanged(bool routes_available) override; |
+ |
+ // Getters of playback state. |
+ // bool paused() const override; |
+ |
+ // True if the loaded media has a playable video track. |
+ // bool hasVideo() const override; |
+ |
+ // This function is called by the RendererMediaPlayerManager to pause the |
+ // video and release the media player and surface texture when we switch tabs. |
+ // However, the actual GlTexture is not released to keep the video screenshot. |
+ void ReleaseMediaResources() override; |
+ |
+#if defined(VIDEO_HOLE) |
+ // Calculate the boundary rectangle of the media player (i.e. location and |
+ // size of the video frame). |
+ // Returns true if the geometry has been changed since the last call. |
+ bool UpdateBoundaryRectangle() override; |
+ |
+ const gfx::RectF GetBoundaryRectangle() override; |
+#endif |
+ |
+ void DrawRemotePlaybackText(const std::string& remote_playback_message); |
+#endif |
+ |
private: |
// Initiate suspending the pipeline. |
void Suspend(); |
@@ -242,7 +314,7 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl |
// Called when a decoder detects that the key needed to decrypt the stream |
// is not available. |
- void OnWaitingForDecryptionKey(); |
+ void OnWaitingForDecryptionKey() override; |
// Sets |cdm_context| on the pipeline and fires |cdm_attached_cb| when done. |
// Parameter order is reversed for easy binding. |
@@ -400,6 +472,25 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl |
scoped_ptr<RendererFactory> renderer_factory_; |
+#if defined(WIMPI_CAST) |
+ // Manages this object and delegates player calls to the browser process. |
+ // Owned by RenderFrameImpl. |
+ RendererMediaPlayerManagerInterface* player_manager_ = nullptr; |
+ |
+ // Player ID assigned by the |player_manager_|. |
+ int player_id_; |
+ |
+ // Whether the browser is currently connected to a remote media player. |
+ bool is_remote_ = false; |
+ |
+ // Last reported playout time. |
+ base::TimeDelta remote_time_; |
+ base::TimeTicks remote_time_at_; |
+ |
+ // Whether the media player has been initialized. |
+ bool is_player_initialized_ = false; |
+#endif |
+ |
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
}; |