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 // Inner class used for transfering frames on compositor thread to |
164 // available. | 164 // |compositor_|. |
165 void OnFrameAvailable(const scoped_refptr<media::VideoFrame>& frame); | 165 class FrameDelivererOnCompositor; |
| 166 |
| 167 void OnFirstFrameReceived(media::VideoRotation video_rotation, |
| 168 bool is_opaque); |
| 169 void OnOpacityChanged(bool is_opaque); |
| 170 |
166 // Need repaint due to state change. | 171 // Need repaint due to state change. |
167 void RepaintInternal(); | 172 void RepaintInternal(); |
168 | 173 |
169 // The callback for source to report error. | 174 // The callback for source to report error. |
170 void OnSourceError(); | 175 void OnSourceError(); |
171 | 176 |
172 // Helpers that set the network/ready state and notifies the client if | 177 // Helpers that set the network/ready state and notifies the client if |
173 // they've changed. | 178 // they've changed. |
174 void SetNetworkState(blink::WebMediaPlayer::NetworkState state); | 179 void SetNetworkState(blink::WebMediaPlayer::NetworkState state); |
175 void SetReadyState(blink::WebMediaPlayer::ReadyState state); | 180 void SetReadyState(blink::WebMediaPlayer::ReadyState state); |
(...skipping 10 matching lines...) Expand all Loading... |
186 | 191 |
187 blink::WebMediaPlayerClient* const client_; | 192 blink::WebMediaPlayerClient* const client_; |
188 | 193 |
189 // WebMediaPlayer notifies the |delegate_| of playback state changes using | 194 // WebMediaPlayer notifies the |delegate_| of playback state changes using |
190 // |delegate_id_|; an id provided after registering with the delegate. The | 195 // |delegate_id_|; an id provided after registering with the delegate. The |
191 // WebMediaPlayer may also receive directives (play, pause) from the delegate | 196 // WebMediaPlayer may also receive directives (play, pause) from the delegate |
192 // via the WebMediaPlayerDelegate::Observer interface after registration. | 197 // via the WebMediaPlayerDelegate::Observer interface after registration. |
193 const base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; | 198 const base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; |
194 int delegate_id_; | 199 int delegate_id_; |
195 | 200 |
| 201 std::unique_ptr<FrameDelivererOnCompositor> frame_deliverer_; |
| 202 |
196 scoped_refptr<MediaStreamVideoRenderer> video_frame_provider_; // Weak | 203 scoped_refptr<MediaStreamVideoRenderer> video_frame_provider_; // Weak |
197 | 204 |
198 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_; | 205 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_; |
199 | 206 |
200 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; // Weak | 207 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; // Weak |
201 media::SkCanvasVideoRenderer video_renderer_; | 208 media::SkCanvasVideoRenderer video_renderer_; |
202 | 209 |
203 bool last_frame_opaque_; | |
204 bool paused_; | 210 bool paused_; |
205 bool render_frame_suspended_; | |
206 bool received_first_frame_; | |
207 media::VideoRotation video_rotation_; | 211 media::VideoRotation video_rotation_; |
208 | 212 |
209 scoped_refptr<media::MediaLog> media_log_; | 213 scoped_refptr<media::MediaLog> media_log_; |
210 | 214 |
211 std::unique_ptr<MediaStreamRendererFactory> renderer_factory_; | 215 std::unique_ptr<MediaStreamRendererFactory> renderer_factory_; |
212 | 216 |
213 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 217 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
214 const scoped_refptr<base::TaskRunner> worker_task_runner_; | 218 const scoped_refptr<base::TaskRunner> worker_task_runner_; |
215 media::GpuVideoAcceleratorFactories* gpu_factories_; | 219 media::GpuVideoAcceleratorFactories* gpu_factories_; |
216 | 220 |
(...skipping 19 matching lines...) Expand all Loading... |
236 // True if playback should be started upon the next call to OnShown(). Only | 240 // True if playback should be started upon the next call to OnShown(). Only |
237 // used on Android. | 241 // used on Android. |
238 bool should_play_upon_shown_; | 242 bool should_play_upon_shown_; |
239 | 243 |
240 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); | 244 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); |
241 }; | 245 }; |
242 | 246 |
243 } // namespace content | 247 } // namespace content |
244 | 248 |
245 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ | 249 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ |
OLD | NEW |