| Index: media/remoting/renderer_controller.cc
|
| diff --git a/media/remoting/renderer_controller.cc b/media/remoting/renderer_controller.cc
|
| index 161ebcde893c71e3323420edfce58db60743b47a..998fa9923aaadfbcac1586a1a36a85f454b634b7 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;
|
| @@ -274,10 +257,9 @@ bool RendererController::ShouldBeRemoting() {
|
| const SharedSession::SessionState state = session_->state();
|
| if (is_encrypted_) {
|
| // 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.
|
| + // remoting session has been started, playback cannot be resumed locally
|
| + // without reloading the page, so leave the CourierRenderer in-place to
|
| + // avoid having the default renderer attempt and fail to play the content.
|
| //
|
| // 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 +346,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());
|
|
|
|
|