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_REMOTING_RENDERER_CONTROLLER_H_ | 5 #ifndef MEDIA_REMOTING_REMOTING_RENDERER_CONTROLLER_H_ |
6 #define MEDIA_REMOTING_REMOTING_RENDERER_CONTROLLER_H_ | 6 #define MEDIA_REMOTING_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 "media/base/media_observer.h" | 10 #include "media/base/media_observer.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 // MediaObserver implementations. | 35 // MediaObserver implementations. |
36 void OnEnteredFullscreen() override; | 36 void OnEnteredFullscreen() override; |
37 void OnExitedFullscreen() override; | 37 void OnExitedFullscreen() override; |
38 void OnBecameDominantVisibleContent(bool is_dominant) override; | 38 void OnBecameDominantVisibleContent(bool is_dominant) override; |
39 void OnSetCdm(CdmContext* cdm_context) override; | 39 void OnSetCdm(CdmContext* cdm_context) override; |
40 void OnMetadataChanged(const PipelineMetadata& metadata) override; | 40 void OnMetadataChanged(const PipelineMetadata& metadata) override; |
41 void OnRemotePlaybackDisabled(bool disabled) override; | 41 void OnRemotePlaybackDisabled(bool disabled) override; |
42 | 42 |
43 void SetSwitchRendererCallback(const base::Closure& cb); | 43 void SetSwitchRendererCallback(const base::Closure& cb); |
| 44 void SetRemoteSinkAvailableChangedCallback( |
| 45 const base::Callback<void(bool)>& cb); |
44 | 46 |
45 base::WeakPtr<RemotingRendererController> GetWeakPtr() { | 47 base::WeakPtr<RemotingRendererController> GetWeakPtr() { |
46 return weak_factory_.GetWeakPtr(); | 48 return weak_factory_.GetWeakPtr(); |
47 } | 49 } |
48 | 50 |
49 // Used by RemotingRendererFactory to query whether to create Media Remoting | 51 // Used by RemotingRendererFactory to query whether to create Media Remoting |
50 // Renderer. | 52 // Renderer. |
51 bool remote_rendering_started() const { | 53 bool remote_rendering_started() const { |
52 DCHECK(thread_checker_.CalledOnValidThread()); | 54 DCHECK(thread_checker_.CalledOnValidThread()); |
53 return remote_rendering_started_; | 55 return remote_rendering_started_; |
(...skipping 23 matching lines...) Expand all Loading... |
77 pipeline_metadata_.audio_decoder_config.IsValidConfig(); | 79 pipeline_metadata_.audio_decoder_config.IsValidConfig(); |
78 } | 80 } |
79 | 81 |
80 bool has_video() const { | 82 bool has_video() const { |
81 return pipeline_metadata_.has_video && | 83 return pipeline_metadata_.has_video && |
82 pipeline_metadata_.video_decoder_config.IsValidConfig(); | 84 pipeline_metadata_.video_decoder_config.IsValidConfig(); |
83 } | 85 } |
84 | 86 |
85 bool IsVideoCodecSupported(); | 87 bool IsVideoCodecSupported(); |
86 bool IsAudioCodecSupported(); | 88 bool IsAudioCodecSupported(); |
| 89 bool IsRemoteSinkAvailable(); |
87 | 90 |
88 // Helper to decide whether to enter or leave Remoting mode. | 91 // Helper to decide whether to enter or leave Remoting mode. |
89 bool ShouldBeRemoting(); | 92 bool ShouldBeRemoting(); |
90 | 93 |
91 // Determines whether to enter or leave Remoting mode and switches if | 94 // Determines whether to enter or leave Remoting mode and switches if |
92 // necessary. | 95 // necessary. |
93 void UpdateAndMaybeSwitch(); | 96 void UpdateAndMaybeSwitch(); |
94 | 97 |
95 // Indicates whether this media element or its ancestor is in full screen. | 98 // Indicates whether this media element or its ancestor is in full screen. |
96 bool is_fullscreen_ = false; | 99 bool is_fullscreen_ = false; |
(...skipping 16 matching lines...) Expand all Loading... |
113 // Remote Playback API spec for more details: | 116 // Remote Playback API spec for more details: |
114 // https://w3c.github.io/remote-playback | 117 // https://w3c.github.io/remote-playback |
115 bool is_remote_playback_disabled_ = true; | 118 bool is_remote_playback_disabled_ = true; |
116 | 119 |
117 // Indicates whether video is the dominant visible content in the tab. | 120 // Indicates whether video is the dominant visible content in the tab. |
118 bool is_dominant_content_ = false; | 121 bool is_dominant_content_ = false; |
119 | 122 |
120 // The callback to switch the media renderer. | 123 // The callback to switch the media renderer. |
121 base::Closure switch_renderer_cb_; | 124 base::Closure switch_renderer_cb_; |
122 | 125 |
| 126 // Called when remoting sink availability is changed. |
| 127 base::Callback<void(bool)> sink_available_changed_cb_; |
| 128 |
123 // This is initially the RemotingSourceImpl passed to the ctor, and might be | 129 // This is initially the RemotingSourceImpl passed to the ctor, and might be |
124 // replaced with a different instance later if OnSetCdm() is called. | 130 // replaced with a different instance later if OnSetCdm() is called. |
125 scoped_refptr<RemotingSourceImpl> remoting_source_; | 131 scoped_refptr<RemotingSourceImpl> remoting_source_; |
126 | 132 |
127 // This is used to check all the methods are called on the current thread in | 133 // This is used to check all the methods are called on the current thread in |
128 // debug builds. | 134 // debug builds. |
129 base::ThreadChecker thread_checker_; | 135 base::ThreadChecker thread_checker_; |
130 | 136 |
131 PipelineMetadata pipeline_metadata_; | 137 PipelineMetadata pipeline_metadata_; |
132 | 138 |
133 base::WeakPtrFactory<RemotingRendererController> weak_factory_; | 139 base::WeakPtrFactory<RemotingRendererController> weak_factory_; |
134 | 140 |
135 DISALLOW_COPY_AND_ASSIGN(RemotingRendererController); | 141 DISALLOW_COPY_AND_ASSIGN(RemotingRendererController); |
136 }; | 142 }; |
137 | 143 |
138 } // namespace media | 144 } // namespace media |
139 | 145 |
140 #endif // MEDIA_REMOTING_REMOTING_RENDERER_CONTROLLER_H_ | 146 #endif // MEDIA_REMOTING_REMOTING_RENDERER_CONTROLLER_H_ |
OLD | NEW |