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_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 protected: | 259 protected: |
260 // Helper method to update the playing state. | 260 // Helper method to update the playing state. |
261 void UpdatePlayingState(bool is_playing_); | 261 void UpdatePlayingState(bool is_playing_); |
262 | 262 |
263 // Helper methods for posting task for setting states and update WebKit. | 263 // Helper methods for posting task for setting states and update WebKit. |
264 void UpdateNetworkState(blink::WebMediaPlayer::NetworkState state); | 264 void UpdateNetworkState(blink::WebMediaPlayer::NetworkState state); |
265 void UpdateReadyState(blink::WebMediaPlayer::ReadyState state); | 265 void UpdateReadyState(blink::WebMediaPlayer::ReadyState state); |
266 void TryCreateStreamTextureProxyIfNeeded(); | 266 void TryCreateStreamTextureProxyIfNeeded(); |
267 void DoCreateStreamTexture(); | 267 void DoCreateStreamTexture(); |
268 | 268 |
269 // This method is meant to be idempotent. Should be called whenever any of | 269 // Helper method to reestablish the surface texture peer for android |
270 // conditions changes and it is ok to establish peer. | 270 // media player. |
271 void EstablishSurfaceTexturePeerIfNeeded(); | 271 void EstablishSurfaceTexturePeer(); |
| 272 |
| 273 // Requesting whether the surface texture peer needs to be reestablished. |
| 274 void SetNeedsEstablishPeer(bool needs_establish_peer); |
272 | 275 |
273 private: | 276 private: |
274 void InitializePlayer(const GURL& url, | 277 void InitializePlayer(const GURL& url, |
275 const GURL& first_party_for_cookies, | 278 const GURL& first_party_for_cookies, |
276 bool allowed_stored_credentials, | 279 bool allowed_stored_credentials, |
277 int demuxer_client_id); | 280 int demuxer_client_id); |
278 void Pause(bool is_media_related_action); | 281 void Pause(bool is_media_related_action); |
279 void DrawRemotePlaybackText(const std::string& remote_playback_message); | 282 void DrawRemotePlaybackText(const std::string& remote_playback_message); |
280 void ReallocateVideoFrame(); | 283 void ReallocateVideoFrame(); |
281 void SetCurrentFrameInternal(scoped_refptr<media::VideoFrame>& frame); | 284 void SetCurrentFrameInternal(scoped_refptr<media::VideoFrame>& frame); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // point for when the mailbox was produced. | 401 // point for when the mailbox was produced. |
399 gpu::Mailbox texture_mailbox_; | 402 gpu::Mailbox texture_mailbox_; |
400 | 403 |
401 // Stream texture ID allocated to the video. | 404 // Stream texture ID allocated to the video. |
402 unsigned int stream_id_; | 405 unsigned int stream_id_; |
403 | 406 |
404 // Whether the mediaplayer is playing. | 407 // Whether the mediaplayer is playing. |
405 bool is_playing_; | 408 bool is_playing_; |
406 | 409 |
407 // Whether media player needs to re-establish the surface texture peer. | 410 // Whether media player needs to re-establish the surface texture peer. |
408 // This should be unset in EstablishSurfaceTexturePeerIfNeeded() only, and set | |
409 // we believe peer is disconnected that we need to establish it again. | |
410 // Setting this should not be conditioned on additional state, eg playing | |
411 // or full screen. | |
412 bool needs_establish_peer_; | 411 bool needs_establish_peer_; |
413 | 412 |
414 // This is a helper state used in EstablishSurfaceTexturePeerIfNeeded(). | |
415 bool in_fullscreen_; | |
416 | |
417 // Whether |stream_texture_proxy_| is initialized. | 413 // Whether |stream_texture_proxy_| is initialized. |
418 bool stream_texture_proxy_initialized_; | 414 bool stream_texture_proxy_initialized_; |
419 | 415 |
420 // Whether the video size info is available. | 416 // Whether the video size info is available. |
421 bool has_size_info_; | 417 bool has_size_info_; |
422 | 418 |
423 // Object for allocating stream textures. | 419 // Object for allocating stream textures. |
424 scoped_refptr<StreamTextureFactory> stream_texture_factory_; | 420 scoped_refptr<StreamTextureFactory> stream_texture_factory_; |
425 | 421 |
426 // Object for calling back the compositor thread to repaint the video when a | 422 // Object for calling back the compositor thread to repaint the video when a |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 495 |
500 // NOTE: Weak pointers must be invalidated before all other member variables. | 496 // NOTE: Weak pointers must be invalidated before all other member variables. |
501 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 497 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
502 | 498 |
503 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 499 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
504 }; | 500 }; |
505 | 501 |
506 } // namespace content | 502 } // namespace content |
507 | 503 |
508 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 504 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |