| 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 #ifndef MEDIA_REMOTING_RENDERER_CONTROLLER_H_ | 5 #ifndef MEDIA_REMOTING_RENDERER_CONTROLLER_H_ |
| 6 #define MEDIA_REMOTING_RENDERER_CONTROLLER_H_ | 6 #define MEDIA_REMOTING_RENDERER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/optional.h" | 10 #include "base/optional.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // MediaObserver implementation. | 37 // MediaObserver implementation. |
| 38 void OnEnteredFullscreen() override; | 38 void OnEnteredFullscreen() override; |
| 39 void OnExitedFullscreen() override; | 39 void OnExitedFullscreen() override; |
| 40 void OnBecameDominantVisibleContent(bool is_dominant) override; | 40 void OnBecameDominantVisibleContent(bool is_dominant) override; |
| 41 void OnSetCdm(CdmContext* cdm_context) override; | 41 void OnSetCdm(CdmContext* cdm_context) override; |
| 42 void OnMetadataChanged(const PipelineMetadata& metadata) override; | 42 void OnMetadataChanged(const PipelineMetadata& metadata) override; |
| 43 void OnRemotePlaybackDisabled(bool disabled) override; | 43 void OnRemotePlaybackDisabled(bool disabled) override; |
| 44 void OnPlaying() override; | 44 void OnPlaying() override; |
| 45 void OnPaused() override; | 45 void OnPaused() override; |
| 46 void OnSetPoster(const GURL& poster) override; | 46 void OnSetPoster(const GURL& poster) override; |
| 47 | 47 void SetClient(MediaObserverClient* client) override; |
| 48 void SetSwitchRendererCallback(const base::Closure& cb); | |
| 49 void SetRemoteSinkAvailableChangedCallback( | |
| 50 const base::Callback<void(bool)>& cb); | |
| 51 | 48 |
| 52 using ShowInterstitialCallback = base::Callback< | 49 using ShowInterstitialCallback = base::Callback< |
| 53 void(const SkBitmap&, const gfx::Size&, InterstitialType type)>; | 50 void(const SkBitmap&, const gfx::Size&, InterstitialType type)>; |
| 54 // Called by the CourierRenderer constructor to set the callback to draw and | 51 // Called by the CourierRenderer constructor to set the callback to draw and |
| 55 // show remoting interstial. | 52 // show remoting interstial. |
| 56 void SetShowInterstitialCallback(const ShowInterstitialCallback& cb); | 53 void SetShowInterstitialCallback(const ShowInterstitialCallback& cb); |
| 57 using DownloadPosterCallback = | 54 using DownloadPosterCallback = |
| 58 base::Callback<void(const GURL&, | 55 base::Callback<void(const GURL&, |
| 59 const base::Callback<void(const SkBitmap&)>&)>; | 56 const base::Callback<void(const SkBitmap&)>&)>; |
| 60 // Set the callback to download poster image. | 57 // Set the callback to download poster image. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 162 |
| 166 // Indicates whether OnRendererFatalError() has been called. This indicates | 163 // Indicates whether OnRendererFatalError() has been called. This indicates |
| 167 // one of several possible problems: 1) An environmental problem such as | 164 // one of several possible problems: 1) An environmental problem such as |
| 168 // out-of-memory, insufficient network bandwidth, etc. 2) The receiver may | 165 // out-of-memory, insufficient network bandwidth, etc. 2) The receiver may |
| 169 // have been unable to play-out the content correctly (e.g., not capable of a | 166 // have been unable to play-out the content correctly (e.g., not capable of a |
| 170 // high frame rate at a high resolution). 3) An implementation bug. In any | 167 // high frame rate at a high resolution). 3) An implementation bug. In any |
| 171 // case, once a renderer encounters a fatal error, remoting will be shut down | 168 // case, once a renderer encounters a fatal error, remoting will be shut down |
| 172 // and never start again for the lifetime of this controller. | 169 // and never start again for the lifetime of this controller. |
| 173 bool encountered_renderer_fatal_error_ = false; | 170 bool encountered_renderer_fatal_error_ = false; |
| 174 | 171 |
| 175 // The callback to switch the media renderer. | |
| 176 base::Closure switch_renderer_cb_; | |
| 177 | |
| 178 // Called when remoting sink availability is changed. | |
| 179 base::Callback<void(bool)> sink_available_changed_cb_; | |
| 180 | |
| 181 // This is initially the SharedSession passed to the ctor, and might be | 172 // This is initially the SharedSession passed to the ctor, and might be |
| 182 // replaced with a different instance later if OnSetCdm() is called. | 173 // replaced with a different instance later if OnSetCdm() is called. |
| 183 scoped_refptr<SharedSession> session_; | 174 scoped_refptr<SharedSession> session_; |
| 184 | 175 |
| 185 // This is used to check all the methods are called on the current thread in | 176 // This is used to check all the methods are called on the current thread in |
| 186 // debug builds. | 177 // debug builds. |
| 187 base::ThreadChecker thread_checker_; | 178 base::ThreadChecker thread_checker_; |
| 188 | 179 |
| 189 // Current pipeline metadata. | 180 // Current pipeline metadata. |
| 190 PipelineMetadata pipeline_metadata_; | 181 PipelineMetadata pipeline_metadata_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 206 GURL poster_url_; | 197 GURL poster_url_; |
| 207 | 198 |
| 208 // The callback to download the poster image. Called when |poster_url_| | 199 // The callback to download the poster image. Called when |poster_url_| |
| 209 // changes during a remoting session or the show interstial callback is set. | 200 // changes during a remoting session or the show interstial callback is set. |
| 210 // OnPosterImageDownloaded() will be called when download completes. | 201 // OnPosterImageDownloaded() will be called when download completes. |
| 211 DownloadPosterCallback download_poster_cb_; | 202 DownloadPosterCallback download_poster_cb_; |
| 212 | 203 |
| 213 // Records session events of interest. | 204 // Records session events of interest. |
| 214 SessionMetricsRecorder metrics_recorder_; | 205 SessionMetricsRecorder metrics_recorder_; |
| 215 | 206 |
| 207 MediaObserverClient* client_; // Outlives this class. |
| 208 |
| 216 base::WeakPtrFactory<RendererController> weak_factory_; | 209 base::WeakPtrFactory<RendererController> weak_factory_; |
| 217 | 210 |
| 218 DISALLOW_COPY_AND_ASSIGN(RendererController); | 211 DISALLOW_COPY_AND_ASSIGN(RendererController); |
| 219 }; | 212 }; |
| 220 | 213 |
| 221 } // namespace remoting | 214 } // namespace remoting |
| 222 } // namespace media | 215 } // namespace media |
| 223 | 216 |
| 224 #endif // MEDIA_REMOTING_RENDERER_CONTROLLER_H_ | 217 #endif // MEDIA_REMOTING_RENDERER_CONTROLLER_H_ |
| OLD | NEW |