| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/remoting/remoting_renderer_controller.h" | 5 #include "media/remoting/remoting_renderer_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
| 10 #include "media/remoting/remoting_cdm_context.h" | 10 #include "media/remoting/remoting_cdm_context.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 UpdateAndMaybeSwitch(); | 53 UpdateAndMaybeSwitch(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void RemotingRendererController::OnExitedFullscreen() { | 56 void RemotingRendererController::OnExitedFullscreen() { |
| 57 DCHECK(thread_checker_.CalledOnValidThread()); | 57 DCHECK(thread_checker_.CalledOnValidThread()); |
| 58 | 58 |
| 59 is_fullscreen_ = false; | 59 is_fullscreen_ = false; |
| 60 UpdateAndMaybeSwitch(); | 60 UpdateAndMaybeSwitch(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void RemotingRendererController::OnBecameDominantVisibleContent( |
| 64 bool is_dominant) { |
| 65 DCHECK(thread_checker_.CalledOnValidThread()); |
| 66 is_dominant_content_ = is_dominant; |
| 67 UpdateAndMaybeSwitch(); |
| 68 } |
| 69 |
| 63 void RemotingRendererController::OnSetCdm(CdmContext* cdm_context) { | 70 void RemotingRendererController::OnSetCdm(CdmContext* cdm_context) { |
| 64 DCHECK(thread_checker_.CalledOnValidThread()); | 71 DCHECK(thread_checker_.CalledOnValidThread()); |
| 65 | 72 |
| 66 auto* remoting_cdm_context = RemotingCdmContext::From(cdm_context); | 73 auto* remoting_cdm_context = RemotingCdmContext::From(cdm_context); |
| 67 if (!remoting_cdm_context) | 74 if (!remoting_cdm_context) |
| 68 return; | 75 return; |
| 69 | 76 |
| 70 remoting_source_->RemoveClient(this); | 77 remoting_source_->RemoveClient(this); |
| 71 remoting_source_ = remoting_cdm_context->GetRemotingSource(); | 78 remoting_source_ = remoting_cdm_context->GetRemotingSource(); |
| 72 remoting_source_->AddClient(this); // Calls OnSessionStateChanged(). | 79 remoting_source_->AddClient(this); // Calls OnSessionStateChanged(). |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 215 |
| 209 if ((!has_audio() && !has_video()) || | 216 if ((!has_audio() && !has_video()) || |
| 210 (has_video() && !IsVideoCodecSupported()) || | 217 (has_video() && !IsVideoCodecSupported()) || |
| 211 (has_audio() && !IsAudioCodecSupported())) { | 218 (has_audio() && !IsAudioCodecSupported())) { |
| 212 return false; | 219 return false; |
| 213 } | 220 } |
| 214 | 221 |
| 215 if (is_remote_playback_disabled_) | 222 if (is_remote_playback_disabled_) |
| 216 return false; | 223 return false; |
| 217 | 224 |
| 218 // Normally, entering fullscreen is the signal that starts remote rendering. | 225 // Normally, entering fullscreen or being the dominant visible content is the |
| 219 // However, current technical limitations require encrypted content be remoted | 226 // signal that starts remote rendering. However, current technical limitations |
| 220 // without waiting for a user signal. | 227 // require encrypted content be remoted without waiting for a user signal. |
| 221 return is_fullscreen_; | 228 return is_fullscreen_ || is_dominant_content_; |
| 222 } | 229 } |
| 223 | 230 |
| 224 void RemotingRendererController::UpdateAndMaybeSwitch() { | 231 void RemotingRendererController::UpdateAndMaybeSwitch() { |
| 225 DCHECK(thread_checker_.CalledOnValidThread()); | 232 DCHECK(thread_checker_.CalledOnValidThread()); |
| 226 | 233 |
| 227 bool should_be_remoting = ShouldBeRemoting(); | 234 bool should_be_remoting = ShouldBeRemoting(); |
| 228 | 235 |
| 229 if (remote_rendering_started_ == should_be_remoting) | 236 if (remote_rendering_started_ == should_be_remoting) |
| 230 return; | 237 return; |
| 231 | 238 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 247 // and never back to the local renderer. The RemotingCdmController will | 254 // and never back to the local renderer. The RemotingCdmController will |
| 248 // force-stop the session when remoting has ended; so no need to call | 255 // force-stop the session when remoting has ended; so no need to call |
| 249 // StopRemoting() from here. | 256 // StopRemoting() from here. |
| 250 DCHECK(!is_encrypted_); | 257 DCHECK(!is_encrypted_); |
| 251 switch_renderer_cb_.Run(); | 258 switch_renderer_cb_.Run(); |
| 252 remoting_source_->StopRemoting(this); | 259 remoting_source_->StopRemoting(this); |
| 253 } | 260 } |
| 254 } | 261 } |
| 255 | 262 |
| 256 } // namespace media | 263 } // namespace media |
| OLD | NEW |