Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(732)

Unified Diff: media/blink/webmediaplayer_impl.h

Issue 2849043002: Send AndroidOverlay routing token from WMPI to AVDA. (Closed)
Patch Set: maybe fixed macos Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/blink/webmediaplayer_impl.h
diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h
index 1829790c7c3eb9a9e7c812f42769dfea222a9d36..a932c714e8ee8465aa4fbe54000b78f8d8346781 100644
--- a/media/blink/webmediaplayer_impl.h
+++ b/media/blink/webmediaplayer_impl.h
@@ -27,6 +27,7 @@
#include "build/build_config.h"
#include "media/base/media_observer.h"
#include "media/base/media_tracks.h"
+#include "media/base/overlay_info.h"
#include "media/base/pipeline_impl.h"
#include "media/base/renderer_factory_selector.h"
#include "media/base/surface_manager.h"
@@ -252,6 +253,14 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
void EnableOverlay();
void DisableOverlay();
+ // Do we have overlay information? For CVV, this is a surface id. For
+ // AndroidOverlay, this is the routing token.
+ bool HaveOverlayInfo();
+
+ // Send the overlay's SurfaceID or routing token. If the decoder didn't
+ // supply a callback for it, then do nothing.
+ void SendOverlayInfoToDecoder();
+
void OnPipelineSuspended();
void OnBeforePipelineResume();
void OnPipelineResumed();
@@ -289,10 +298,14 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// Called by SurfaceManager when a surface is created.
void OnSurfaceCreated(int surface_id);
+ // Called by RenderFrameImpl with the overlay routing token, if we request it.
+ void OnOverlayRoutingToken(const base::UnguessableToken& token);
+
// Called by GpuVideoDecoder on Android to request a surface to render to (if
// necessary).
- void OnSurfaceRequested(bool decoder_requires_restart_for_overlay,
- const SurfaceCreatedCB& surface_created_cb);
+ void OnOverlayInfoRequested(
+ bool decoder_requires_restart_for_overlay,
+ const ProvideOverlayInfoCB& provide_overlay_info_cb);
// Creates a Renderer via the |renderer_factory_selector_|.
std::unique_ptr<Renderer> CreateRenderer();
@@ -644,11 +657,15 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// request to the SurfaceManager.
base::Optional<int> overlay_surface_id_;
- // If a surface is requested before it's finished being created, the request
- // is saved and satisfied once the surface is available. If the decoder does
- // not require restart to change surfaces, this is callback is kept until
- // cleared by the decoder.
- SurfaceCreatedCB set_surface_cb_;
+ // For canceling AndroidOverlay routing token requests.
+ base::CancelableCallback<void(const base::UnguessableToken&)>
+ token_available_cb_;
+
+ // If overlay info is requested before we have it, then the request is saved
+ // and satisfied once the overlay info is available. If the decoder does not
+ // require restart to change surfaces, this is callback is kept until cleared
+ // by the decoder.
+ ProvideOverlayInfoCB provide_overlay_info_cb_;
// On Android an overlay surface means using
// SurfaceView instead of SurfaceTexture.
@@ -656,10 +673,6 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// Use overlays for all video.
bool force_video_overlays_;
- // Use overlays for fullscreen video.
- // (Implied if |force_video_overlays_| is true.)
- bool enable_fullscreen_video_overlays_;
-
// Suppresses calls to OnPipelineError() after destruction / shutdown has been
// started; prevents us from spuriously logging errors that are transient or
// unimportant.
@@ -744,6 +757,27 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
bool initial_video_height_recorded_ = false;
+ enum class OverlayMode {
+ // All overlays are turned off.
+ kNoOverlays,
+
+ // Use ContentVideoView for overlays.
+ kUseContentVideoView,
+
+ // Use AndroidOverlay for overlays.
+ kUseAndroidOverlay,
+ };
+
+ OverlayMode overlay_mode_ = OverlayMode::kNoOverlays;
+
+ // Optional callback to request the routing token for AndroidOverlay.
+ RequestRoutingTokenCallback request_routing_token_cb_;
+
+ // Routing token, if we have one. No value if we have a request pending to
+ // get it via |request_routing_token_cb_|. A null token indicates that we
+ // have no token, which can't be sent via IPC.
tguilbert 2017/05/08 23:10:29 Can you clarify the states in this comment? IIUC,
liberato (no reviews please) 2017/05/09 16:55:37 s/null/empty/: Done for has_value && is_empty, we
+ base::Optional<base::UnguessableToken> overlay_routing_token_;
+
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
};

Powered by Google App Engine
This is Rietveld 408576698