OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 bool copyVideoTextureToPlatformTexture(gpu::gles2::GLES2Interface* gl, | 153 bool copyVideoTextureToPlatformTexture(gpu::gles2::GLES2Interface* gl, |
154 unsigned int texture, | 154 unsigned int texture, |
155 unsigned int internal_format, | 155 unsigned int internal_format, |
156 unsigned int type, | 156 unsigned int type, |
157 bool premultiply_alpha, | 157 bool premultiply_alpha, |
158 bool flip_y) override; | 158 bool flip_y) override; |
159 | 159 |
160 private: | 160 private: |
161 friend class WebMediaPlayerMSTest; | 161 friend class WebMediaPlayerMSTest; |
162 | 162 |
163 // The callback for MediaStreamVideoRenderer to signal a new frame is | 163 void OnFirstFrameReceived(media::VideoRotation video_rotation, |
164 // available. | 164 bool is_opaque); |
165 void OnFrameAvailable(const scoped_refptr<media::VideoFrame>& frame); | 165 void OnOpacityChanged(bool is_opaque); |
| 166 |
166 // Need repaint due to state change. | 167 // Need repaint due to state change. |
167 void RepaintInternal(); | 168 void RepaintInternal(); |
168 | 169 |
169 // The callback for source to report error. | 170 // The callback for source to report error. |
170 void OnSourceError(); | 171 void OnSourceError(); |
171 | 172 |
172 // Helpers that set the network/ready state and notifies the client if | 173 // Helpers that set the network/ready state and notifies the client if |
173 // they've changed. | 174 // they've changed. |
174 void SetNetworkState(blink::WebMediaPlayer::NetworkState state); | 175 void SetNetworkState(blink::WebMediaPlayer::NetworkState state); |
175 void SetReadyState(blink::WebMediaPlayer::ReadyState state); | 176 void SetReadyState(blink::WebMediaPlayer::ReadyState state); |
(...skipping 10 matching lines...) Expand all Loading... |
186 | 187 |
187 blink::WebMediaPlayerClient* const client_; | 188 blink::WebMediaPlayerClient* const client_; |
188 | 189 |
189 // WebMediaPlayer notifies the |delegate_| of playback state changes using | 190 // WebMediaPlayer notifies the |delegate_| of playback state changes using |
190 // |delegate_id_|; an id provided after registering with the delegate. The | 191 // |delegate_id_|; an id provided after registering with the delegate. The |
191 // WebMediaPlayer may also receive directives (play, pause) from the delegate | 192 // WebMediaPlayer may also receive directives (play, pause) from the delegate |
192 // via the WebMediaPlayerDelegate::Observer interface after registration. | 193 // via the WebMediaPlayerDelegate::Observer interface after registration. |
193 const base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; | 194 const base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; |
194 int delegate_id_; | 195 int delegate_id_; |
195 | 196 |
| 197 // Inner class used for transfering frames on compositor thread to |
| 198 // |compositor_|. |
| 199 class FrameDeliverer; |
| 200 std::unique_ptr<FrameDeliverer> frame_deliverer_; |
| 201 |
196 scoped_refptr<MediaStreamVideoRenderer> video_frame_provider_; // Weak | 202 scoped_refptr<MediaStreamVideoRenderer> video_frame_provider_; // Weak |
197 | 203 |
198 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_; | 204 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_; |
199 | 205 |
200 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; // Weak | 206 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; // Weak |
201 media::SkCanvasVideoRenderer video_renderer_; | 207 media::SkCanvasVideoRenderer video_renderer_; |
202 | 208 |
203 bool last_frame_opaque_; | |
204 bool paused_; | 209 bool paused_; |
205 bool render_frame_suspended_; | |
206 bool received_first_frame_; | |
207 media::VideoRotation video_rotation_; | 210 media::VideoRotation video_rotation_; |
208 | 211 |
209 scoped_refptr<media::MediaLog> media_log_; | 212 scoped_refptr<media::MediaLog> media_log_; |
210 | 213 |
211 std::unique_ptr<MediaStreamRendererFactory> renderer_factory_; | 214 std::unique_ptr<MediaStreamRendererFactory> renderer_factory_; |
212 | 215 |
213 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 216 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
214 const scoped_refptr<base::TaskRunner> worker_task_runner_; | 217 const scoped_refptr<base::TaskRunner> worker_task_runner_; |
215 media::GpuVideoAcceleratorFactories* gpu_factories_; | 218 media::GpuVideoAcceleratorFactories* gpu_factories_; |
216 | 219 |
(...skipping 19 matching lines...) Expand all Loading... |
236 // True if playback should be started upon the next call to OnShown(). Only | 239 // True if playback should be started upon the next call to OnShown(). Only |
237 // used on Android. | 240 // used on Android. |
238 bool should_play_upon_shown_; | 241 bool should_play_upon_shown_; |
239 | 242 |
240 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); | 243 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); |
241 }; | 244 }; |
242 | 245 |
243 } // namespace content | 246 } // namespace content |
244 | 247 |
245 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ | 248 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ |
OLD | NEW |