| 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_REMOTE_RENDERER_IMPL_H_ | 5 #ifndef MEDIA_REMOTING_REMOTE_RENDERER_IMPL_H_ |
| 6 #define MEDIA_REMOTING_REMOTE_RENDERER_IMPL_H_ | 6 #define MEDIA_REMOTING_REMOTE_RENDERER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 mojo::ScopedDataPipeProducerHandle video_handle); | 60 mojo::ScopedDataPipeProducerHandle video_handle); |
| 61 | 61 |
| 62 // Callback function when RPC message is received. The function is set to | 62 // Callback function when RPC message is received. The function is set to |
| 63 // static in order to post task to media thread in order to avoid threading | 63 // static in order to post task to media thread in order to avoid threading |
| 64 // race condition. | 64 // race condition. |
| 65 static void OnMessageReceivedOnMainThread( | 65 static void OnMessageReceivedOnMainThread( |
| 66 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, | 66 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, |
| 67 base::WeakPtr<RemoteRendererImpl> self, | 67 base::WeakPtr<RemoteRendererImpl> self, |
| 68 std::unique_ptr<remoting::pb::RpcMessage> message); | 68 std::unique_ptr<remoting::pb::RpcMessage> message); |
| 69 | 69 |
| 70 // Callback when remoting interstitial needs to be updated. Will post task to |
| 71 // media thread to avoid threading race condition. |
| 72 static void RequestUpdateInterstitialOnMainThread( |
| 73 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, |
| 74 base::WeakPtr<RemoteRendererImpl> remote_renderer_impl, |
| 75 VideoRendererSink* video_renderer_sink, |
| 76 const SkBitmap& background_image, |
| 77 const gfx::Size& canvas_size, |
| 78 RemotingInterstitialType interstitial_type); |
| 79 |
| 70 public: | 80 public: |
| 71 // media::Renderer implementation. | 81 // media::Renderer implementation. |
| 72 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, | 82 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, |
| 73 media::RendererClient* client, | 83 media::RendererClient* client, |
| 74 const PipelineStatusCB& init_cb) final; | 84 const PipelineStatusCB& init_cb) final; |
| 75 void SetCdm(CdmContext* cdm_context, | 85 void SetCdm(CdmContext* cdm_context, |
| 76 const CdmAttachedCB& cdm_attached_cb) final; | 86 const CdmAttachedCB& cdm_attached_cb) final; |
| 77 void Flush(const base::Closure& flush_cb) final; | 87 void Flush(const base::Closure& flush_cb) final; |
| 78 void StartPlayingFrom(base::TimeDelta time) final; | 88 void StartPlayingFrom(base::TimeDelta time) final; |
| 79 void SetPlaybackRate(double playback_rate) final; | 89 void SetPlaybackRate(double playback_rate) final; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 void SetCdmCallback(std::unique_ptr<remoting::pb::RpcMessage> message); | 124 void SetCdmCallback(std::unique_ptr<remoting::pb::RpcMessage> message); |
| 115 void OnTimeUpdate(std::unique_ptr<remoting::pb::RpcMessage> message); | 125 void OnTimeUpdate(std::unique_ptr<remoting::pb::RpcMessage> message); |
| 116 void OnBufferingStateChange( | 126 void OnBufferingStateChange( |
| 117 std::unique_ptr<remoting::pb::RpcMessage> message); | 127 std::unique_ptr<remoting::pb::RpcMessage> message); |
| 118 void OnVideoNaturalSizeChange( | 128 void OnVideoNaturalSizeChange( |
| 119 std::unique_ptr<remoting::pb::RpcMessage> message); | 129 std::unique_ptr<remoting::pb::RpcMessage> message); |
| 120 void OnVideoOpacityChange(std::unique_ptr<remoting::pb::RpcMessage> message); | 130 void OnVideoOpacityChange(std::unique_ptr<remoting::pb::RpcMessage> message); |
| 121 void OnStatisticsUpdate(std::unique_ptr<remoting::pb::RpcMessage> message); | 131 void OnStatisticsUpdate(std::unique_ptr<remoting::pb::RpcMessage> message); |
| 122 void OnDurationChange(std::unique_ptr<remoting::pb::RpcMessage> message); | 132 void OnDurationChange(std::unique_ptr<remoting::pb::RpcMessage> message); |
| 123 | 133 |
| 134 // Called to update the remoting interstitial. |
| 135 void UpdateInterstitial(VideoRendererSink* video_renderer_sink, |
| 136 const SkBitmap& background_image, |
| 137 const gfx::Size& canvas_size, |
| 138 RemotingInterstitialType interstitial_type); |
| 139 |
| 124 // Shut down remoting session. | 140 // Shut down remoting session. |
| 125 void OnFatalError(PipelineStatus status); | 141 void OnFatalError(PipelineStatus status); |
| 126 | 142 |
| 127 // Show interstial accordingly. | |
| 128 void UpdateInterstitial(); | |
| 129 | |
| 130 State state_; | 143 State state_; |
| 131 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 144 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 132 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 145 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
| 133 | 146 |
| 134 // Current renderer playback time information. | 147 // Current renderer playback time information. |
| 135 base::TimeDelta current_media_time_; | 148 base::TimeDelta current_media_time_; |
| 136 base::TimeDelta current_max_time_; | 149 base::TimeDelta current_max_time_; |
| 137 // Both |current_media_time_| and |current_max_time_| should be protected by | 150 // Both |current_media_time_| and |current_max_time_| should be protected by |
| 138 // lock because it can be accessed from both media and render main thread. | 151 // lock because it can be accessed from both media and render main thread. |
| 139 base::Lock time_lock_; | 152 base::Lock time_lock_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 153 const int rpc_handle_; | 166 const int rpc_handle_; |
| 154 | 167 |
| 155 // RPC handle value for render on receiver endpoint. | 168 // RPC handle value for render on receiver endpoint. |
| 156 int remote_renderer_handle_; | 169 int remote_renderer_handle_; |
| 157 | 170 |
| 158 // Callbacks. | 171 // Callbacks. |
| 159 PipelineStatusCB init_workflow_done_callback_; | 172 PipelineStatusCB init_workflow_done_callback_; |
| 160 CdmAttachedCB cdm_attached_cb_; | 173 CdmAttachedCB cdm_attached_cb_; |
| 161 base::Closure flush_cb_; | 174 base::Closure flush_cb_; |
| 162 | 175 |
| 163 RemotingInterstitialUI interstitial_ui_; | |
| 164 | |
| 165 base::WeakPtrFactory<RemoteRendererImpl> weak_factory_; | 176 base::WeakPtrFactory<RemoteRendererImpl> weak_factory_; |
| 166 | 177 |
| 167 DISALLOW_COPY_AND_ASSIGN(RemoteRendererImpl); | 178 DISALLOW_COPY_AND_ASSIGN(RemoteRendererImpl); |
| 168 }; | 179 }; |
| 169 | 180 |
| 170 } // namespace media | 181 } // namespace media |
| 171 | 182 |
| 172 #endif // MEDIA_REMOTING_REMOTE_RENDERER_IMPL_H_ | 183 #endif // MEDIA_REMOTING_REMOTE_RENDERER_IMPL_H_ |
| OLD | NEW |