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

Unified Diff: media/remoting/remoting_controller.h

Issue 2475643004: Monitor the intersection of video and viewport. (Closed)
Patch Set: Moved the calculation of intersection ratio to RemotingController. Created 4 years, 1 month 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/remoting/remoting_controller.h
diff --git a/media/remoting/remoting_controller.h b/media/remoting/remoting_controller.h
index f565d66d89a5d6b6e8340f9a8a42af296d8e7936..31756886fad284ef9d300ff639b0bb645e46fda0 100644
--- a/media/remoting/remoting_controller.h
+++ b/media/remoting/remoting_controller.h
@@ -7,6 +7,7 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
+#include "base/timer/timer.h"
#include "media/base/media_observer.h"
#include "media/mojo/interfaces/remoting.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
@@ -52,12 +53,10 @@ class RemotingController final : public MediaObserver,
void OnStopped(mojom::RemotingStopReason reason) override;
// MediaObserver implementations.
- // This is called when the video element or its ancestor enters full screen.
- // We currently use this as an indicator for immersive playback. May add other
- // criteria (e.g. the actual display width/height of the video element) in
- // future.
void OnEnteredFullscreen() override;
void OnExitedFullscreen() override;
+ void OnVideoViewportIntersectionChanged(
+ const ViewportIntersectionInfo& info) override;
void OnSetCdm(CdmContext* cdm_context) override;
void OnMetadataChanged(const PipelineMetadata& metadata) override;
@@ -90,6 +89,10 @@ class RemotingController final : public MediaObserver,
// Callback from RpcBroker when sending message to remote sink.
void OnSendMessageToSink(std::unique_ptr<std::vector<uint8_t>> message);
+ // Callback from |viewport_fill_debouncer_timer_| when video keeps covering
+ // most of the viewport for a certain time.
+ void OnViewportMostlyFilledAndUnchanging();
+
// Handle incomging and outgoing RPC message.
std::unique_ptr<remoting::RpcBroker> rpc_broker_;
@@ -111,6 +114,12 @@ class RemotingController final : public MediaObserver,
bool has_audio_ = false;
bool has_video_ = false;
+ // Indicates whether video covers most of the viewport.
+ bool is_mostly_filling_viewport_ = false;
+ // Video/Viewport ratio meeting/exceeding the threshold should hold steady for
miu 2016/11/16 02:40:26 nit: Please add a blank line above this line.
xjz 2016/11/16 07:45:55 Done.
+ // a certain time before attempting to start remoting.
+ base::OneShotTimer viewport_fill_debouncer_timer_;
+
// The callback to switch the media renderer.
SwitchRendererCallback switch_renderer_cb_;

Powered by Google App Engine
This is Rietveld 408576698