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> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/optional.h" |
16 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
17 #include "media/base/buffering_state.h" | 18 #include "media/base/buffering_state.h" |
18 #include "media/base/pipeline_status.h" | 19 #include "media/base/pipeline_status.h" |
19 #include "media/base/renderer.h" | 20 #include "media/base/renderer.h" |
20 #include "media/base/renderer_client.h" | 21 #include "media/base/renderer_client.h" |
21 #include "media/mojo/interfaces/remoting.mojom.h" | 22 #include "media/mojo/interfaces/remoting.mojom.h" |
22 #include "media/remoting/remoting_interstitial_ui.h" | 23 #include "media/remoting/remoting_interstitial_ui.h" |
23 #include "media/remoting/rpc/rpc_broker.h" | 24 #include "media/remoting/rpc/rpc_broker.h" |
24 #include "mojo/public/cpp/system/data_pipe.h" | 25 #include "mojo/public/cpp/system/data_pipe.h" |
25 | 26 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 static void OnMessageReceivedOnMainThread( | 66 static void OnMessageReceivedOnMainThread( |
66 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, | 67 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, |
67 base::WeakPtr<RemoteRendererImpl> self, | 68 base::WeakPtr<RemoteRendererImpl> self, |
68 std::unique_ptr<remoting::pb::RpcMessage> message); | 69 std::unique_ptr<remoting::pb::RpcMessage> message); |
69 | 70 |
70 // Callback when remoting interstitial needs to be updated. Will post task to | 71 // Callback when remoting interstitial needs to be updated. Will post task to |
71 // media thread to avoid threading race condition. | 72 // media thread to avoid threading race condition. |
72 static void RequestUpdateInterstitialOnMainThread( | 73 static void RequestUpdateInterstitialOnMainThread( |
73 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, | 74 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, |
74 base::WeakPtr<RemoteRendererImpl> remote_renderer_impl, | 75 base::WeakPtr<RemoteRendererImpl> remote_renderer_impl, |
75 const SkBitmap& background_image, | 76 const base::Optional<SkBitmap>& background_image, |
76 const gfx::Size& canvas_size, | 77 const gfx::Size& canvas_size, |
77 RemotingInterstitialType interstitial_type); | 78 RemotingInterstitialType interstitial_type); |
78 | 79 |
79 public: | 80 public: |
80 // media::Renderer implementation. | 81 // media::Renderer implementation. |
81 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, | 82 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, |
82 media::RendererClient* client, | 83 media::RendererClient* client, |
83 const PipelineStatusCB& init_cb) final; | 84 const PipelineStatusCB& init_cb) final; |
84 void SetCdm(CdmContext* cdm_context, | 85 void SetCdm(CdmContext* cdm_context, |
85 const CdmAttachedCB& cdm_attached_cb) final; | 86 const CdmAttachedCB& cdm_attached_cb) final; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 void SetCdmCallback(std::unique_ptr<remoting::pb::RpcMessage> message); | 124 void SetCdmCallback(std::unique_ptr<remoting::pb::RpcMessage> message); |
124 void OnTimeUpdate(std::unique_ptr<remoting::pb::RpcMessage> message); | 125 void OnTimeUpdate(std::unique_ptr<remoting::pb::RpcMessage> message); |
125 void OnBufferingStateChange( | 126 void OnBufferingStateChange( |
126 std::unique_ptr<remoting::pb::RpcMessage> message); | 127 std::unique_ptr<remoting::pb::RpcMessage> message); |
127 void OnVideoNaturalSizeChange( | 128 void OnVideoNaturalSizeChange( |
128 std::unique_ptr<remoting::pb::RpcMessage> message); | 129 std::unique_ptr<remoting::pb::RpcMessage> message); |
129 void OnVideoOpacityChange(std::unique_ptr<remoting::pb::RpcMessage> message); | 130 void OnVideoOpacityChange(std::unique_ptr<remoting::pb::RpcMessage> message); |
130 void OnStatisticsUpdate(std::unique_ptr<remoting::pb::RpcMessage> message); | 131 void OnStatisticsUpdate(std::unique_ptr<remoting::pb::RpcMessage> message); |
131 void OnDurationChange(std::unique_ptr<remoting::pb::RpcMessage> message); | 132 void OnDurationChange(std::unique_ptr<remoting::pb::RpcMessage> message); |
132 | 133 |
133 // Called to update the remoting interstitial. Draw remoting interstitial on | 134 // Called to update the remoting interstitial. Update |
134 // |interstitial_background_| if |background_image| is empty. Update | 135 // |interstitial_background_| if |background_image| is set. |
135 // |interstitial_background_| if |background_image| is not empty. | 136 void UpdateInterstitial(const base::Optional<SkBitmap>& background_image, |
136 void UpdateInterstitial(const SkBitmap& background_image, | |
137 const gfx::Size& canvas_size, | 137 const gfx::Size& canvas_size, |
138 RemotingInterstitialType interstitial_type); | 138 RemotingInterstitialType interstitial_type); |
139 | 139 |
140 // Shut down remoting session. | 140 // Shut down remoting session. |
141 void OnFatalError(PipelineStatus status); | 141 void OnFatalError(PipelineStatus status); |
142 | 142 |
143 State state_; | 143 State state_; |
144 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 144 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
145 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 145 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
146 | 146 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 gfx::Size canvas_size_; | 181 gfx::Size canvas_size_; |
182 | 182 |
183 base::WeakPtrFactory<RemoteRendererImpl> weak_factory_; | 183 base::WeakPtrFactory<RemoteRendererImpl> weak_factory_; |
184 | 184 |
185 DISALLOW_COPY_AND_ASSIGN(RemoteRendererImpl); | 185 DISALLOW_COPY_AND_ASSIGN(RemoteRendererImpl); |
186 }; | 186 }; |
187 | 187 |
188 } // namespace media | 188 } // namespace media |
189 | 189 |
190 #endif // MEDIA_REMOTING_REMOTE_RENDERER_IMPL_H_ | 190 #endif // MEDIA_REMOTING_REMOTE_RENDERER_IMPL_H_ |
OLD | NEW |