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

Unified Diff: media/remoting/renderer_controller.cc

Issue 2801853002: Media Remoting: Remove old interstitial implementation. (Closed)
Patch Set: Created 3 years, 8 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/remoting/renderer_controller.cc
diff --git a/media/remoting/renderer_controller.cc b/media/remoting/renderer_controller.cc
index 161ebcde893c71e3323420edfce58db60743b47a..aec0693e58303b8cd087dc8f071c43f37a32d76a 100644
--- a/media/remoting/renderer_controller.cc
+++ b/media/remoting/renderer_controller.cc
@@ -55,7 +55,6 @@ void RendererController::UpdateFromSessionState(StartTrigger start_trigger,
if (client_)
client_->ActivateViewportIntersectionMonitoring(IsRemoteSinkAvailable());
- UpdateInterstitial(base::nullopt);
UpdateAndMaybeSwitch(start_trigger, stop_trigger);
}
@@ -139,18 +138,6 @@ void RendererController::OnRemotePlaybackDisabled(bool disabled) {
UpdateAndMaybeSwitch(ENABLED_BY_PAGE, DISABLED_BY_PAGE);
}
-void RendererController::OnSetPoster(const GURL& poster_url) {
- DCHECK(thread_checker_.CalledOnValidThread());
-
- if (poster_url != poster_url_) {
- poster_url_ = poster_url;
- if (poster_url_.is_empty())
- UpdateInterstitial(SkBitmap());
- else
- DownloadPosterImage();
- }
-}
-
base::WeakPtr<RpcBroker> RendererController::GetRpcBroker() const {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -170,7 +157,6 @@ void RendererController::StartDataPipe(
void RendererController::OnMetadataChanged(const PipelineMetadata& metadata) {
DCHECK(thread_checker_.CalledOnValidThread());
- const gfx::Size old_size = pipeline_metadata_.natural_size;
const bool was_audio_codec_supported = has_audio() && IsAudioCodecSupported();
const bool was_video_codec_supported = has_video() && IsVideoCodecSupported();
pipeline_metadata_ = metadata;
@@ -184,9 +170,6 @@ void RendererController::OnMetadataChanged(const PipelineMetadata& metadata) {
if (has_audio())
is_encrypted_ |= metadata.audio_decoder_config.is_encrypted();
- if (pipeline_metadata_.natural_size != old_size)
- UpdateInterstitial(base::nullopt);
-
StartTrigger start_trigger = UNKNOWN_START_TRIGGER;
if (!was_audio_codec_supported && is_audio_codec_supported)
start_trigger = SUPPORTED_AUDIO_CODEC;
@@ -276,8 +259,8 @@ bool RendererController::ShouldBeRemoting() {
// Due to technical limitations when playing encrypted content, once a
// remoting session has been started, always return true here to indicate
// that the CourierRenderer should continue to be used. In the stopped
- // states, CourierRenderer will display an interstitial to notify the user
- // that local rendering cannot be resumed.
+ // states, an interstitial will be shown to notify the user that local
miu 2017/04/13 02:15:10 I'm wondering if we need this last sentence anymor
xjz 2017/04/13 23:48:36 Done.
+ // rendering cannot be resumed.
//
// TODO(miu): Revisit this once more of the encrypted-remoting impl is
// in-place. For example, this will prevent metrics from recording session
@@ -364,99 +347,11 @@ void RendererController::UpdateAndMaybeSwitch(StartTrigger start_trigger,
DCHECK(!is_encrypted_);
DCHECK_NE(stop_trigger, UNKNOWN_STOP_TRIGGER);
metrics_recorder_.WillStopSession(stop_trigger);
- // Update the interstitial one last time before switching back to the local
- // Renderer.
- UpdateInterstitial(base::nullopt);
client_->SwitchRenderer(false);
session_->StopRemoting(this);
}
}
-void RendererController::SetShowInterstitialCallback(
- const ShowInterstitialCallback& cb) {
- DCHECK(thread_checker_.CalledOnValidThread());
- show_interstitial_cb_ = cb;
- UpdateInterstitial(SkBitmap());
- if (!poster_url_.is_empty())
- DownloadPosterImage();
-}
-
-void RendererController::SetDownloadPosterCallback(
- const DownloadPosterCallback& cb) {
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(download_poster_cb_.is_null());
- download_poster_cb_ = cb;
- if (!poster_url_.is_empty())
- DownloadPosterImage();
-}
-
-void RendererController::UpdateInterstitial(
- const base::Optional<SkBitmap>& image) {
- DCHECK(thread_checker_.CalledOnValidThread());
- if (show_interstitial_cb_.is_null())
- return;
-
- InterstitialType type = InterstitialType::BETWEEN_SESSIONS;
- switch (remote_rendering_started_ ? session_->state()
- : SharedSession::SESSION_STOPPING) {
- case SharedSession::SESSION_STARTED:
- type = InterstitialType::IN_SESSION;
- break;
- case SharedSession::SESSION_PERMANENTLY_STOPPED:
- type = InterstitialType::ENCRYPTED_MEDIA_FATAL_ERROR;
- break;
- case SharedSession::SESSION_UNAVAILABLE:
- case SharedSession::SESSION_CAN_START:
- case SharedSession::SESSION_STARTING:
- case SharedSession::SESSION_STOPPING:
- break;
- }
-
- bool needs_update = false;
- if (image.has_value()) {
- interstitial_background_ = image.value();
- needs_update = true;
- }
- if (interstitial_natural_size_ != pipeline_metadata_.natural_size) {
- interstitial_natural_size_ = pipeline_metadata_.natural_size;
- needs_update = true;
- }
- if (interstitial_type_ != type) {
- interstitial_type_ = type;
- needs_update = true;
- }
- if (!needs_update)
- return;
-
- show_interstitial_cb_.Run(interstitial_background_,
- interstitial_natural_size_, interstitial_type_);
-}
-
-void RendererController::DownloadPosterImage() {
- if (download_poster_cb_.is_null() || show_interstitial_cb_.is_null())
- return;
- DCHECK(!poster_url_.is_empty());
-
- const base::TimeTicks download_start_time = base::TimeTicks::Now();
- download_poster_cb_.Run(
- poster_url_,
- base::Bind(&RendererController::OnPosterImageDownloaded,
- weak_factory_.GetWeakPtr(), poster_url_, download_start_time));
-}
-
-void RendererController::OnPosterImageDownloaded(
- const GURL& download_url,
- base::TimeTicks download_start_time,
- const SkBitmap& image) {
- DCHECK(thread_checker_.CalledOnValidThread());
-
- metrics_recorder_.OnPosterImageDownloaded(
- base::TimeTicks::Now() - download_start_time, !image.drawsNothing());
- if (download_url != poster_url_)
- return; // The poster image URL has changed during the download.
- UpdateInterstitial(image);
-}
-
void RendererController::OnRendererFatalError(StopTrigger stop_trigger) {
DCHECK(thread_checker_.CalledOnValidThread());
« media/remoting/renderer_controller.h ('K') | « media/remoting/renderer_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698