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

Unified Diff: media/remoting/remoting_renderer_controller.h

Issue 2511143006: Detect change on the intersection of video and viewport. (Closed)
Patch Set: 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_renderer_controller.h
diff --git a/media/remoting/remoting_renderer_controller.h b/media/remoting/remoting_renderer_controller.h
index 9c98af12b555441c1ade86ff34291b321c7a8076..35d505fe8226c2f3b5ae2134559d52f2ce4e1c34 100644
--- a/media/remoting/remoting_renderer_controller.h
+++ b/media/remoting/remoting_renderer_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/remoting/remoting_source_impl.h"
@@ -35,6 +36,8 @@ class RemotingRendererController final : public RemotingSourceImpl::Client,
// MediaObserver implementations.
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 +93,10 @@ class RemotingRendererController final : public RemotingSourceImpl::Client,
// necessary.
void UpdateAndMaybeSwitch();
+ // Callback from |viewport_fill_debouncer_timer_| when video keeps covering
+ // most of the viewport for a certain time.
+ void OnViewportMostlyFilledAndUnchanging();
+
// Indicates whether this media element or its ancestor is in full screen.
bool is_fullscreen_ = false;
@@ -103,6 +110,13 @@ class RemotingRendererController final : public RemotingSourceImpl::Client,
VideoDecoderConfig video_decoder_config_;
AudioDecoderConfig audio_decoder_config_;
+ // 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
+ // a certain time before attempting to start remoting.
+ base::OneShotTimer viewport_fill_debouncer_timer_;
+
// The callback to switch the media renderer.
base::Closure switch_renderer_cb_;

Powered by Google App Engine
This is Rietveld 408576698