| 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 MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // (Public for testing.) | 225 // (Public for testing.) |
| 226 struct PlayState { | 226 struct PlayState { |
| 227 DelegateState delegate_state; | 227 DelegateState delegate_state; |
| 228 bool is_memory_reporting_enabled; | 228 bool is_memory_reporting_enabled; |
| 229 bool is_suspended; | 229 bool is_suspended; |
| 230 }; | 230 }; |
| 231 | 231 |
| 232 private: | 232 private: |
| 233 friend class WebMediaPlayerImplTest; | 233 friend class WebMediaPlayerImplTest; |
| 234 | 234 |
| 235 void EnableOverlay(); |
| 236 void DisableOverlay(); |
| 237 |
| 235 void OnPipelineSuspended(); | 238 void OnPipelineSuspended(); |
| 236 void OnDemuxerOpened(); | 239 void OnDemuxerOpened(); |
| 237 | 240 |
| 238 // Pipeline::Client overrides. | 241 // Pipeline::Client overrides. |
| 239 void OnError(PipelineStatus status) override; | 242 void OnError(PipelineStatus status) override; |
| 240 void OnEnded() override; | 243 void OnEnded() override; |
| 241 void OnMetadata(PipelineMetadata metadata) override; | 244 void OnMetadata(PipelineMetadata metadata) override; |
| 242 void OnBufferingStateChange(BufferingState state) override; | 245 void OnBufferingStateChange(BufferingState state) override; |
| 243 void OnDurationChange() override; | 246 void OnDurationChange() override; |
| 244 void OnAddTextTrack(const TextTrackConfig& config, | 247 void OnAddTextTrack(const TextTrackConfig& config, |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 bool pending_suspend_resume_cycle_; | 425 bool pending_suspend_resume_cycle_; |
| 423 | 426 |
| 424 // TODO(scherkus): Replace with an explicit ended signal to HTMLMediaElement, | 427 // TODO(scherkus): Replace with an explicit ended signal to HTMLMediaElement, |
| 425 // see http://crbug.com/409280 | 428 // see http://crbug.com/409280 |
| 426 bool ended_; | 429 bool ended_; |
| 427 | 430 |
| 428 // Tracks whether to issue time changed notifications during buffering state | 431 // Tracks whether to issue time changed notifications during buffering state |
| 429 // changes. | 432 // changes. |
| 430 bool should_notify_time_changed_; | 433 bool should_notify_time_changed_; |
| 431 | 434 |
| 432 bool fullscreen_; | 435 bool overlay_enabled_; |
| 433 | 436 |
| 434 // Whether the current decoder requires a restart on fullscreen transitions. | 437 // Whether the current decoder requires a restart on overlay transitions. |
| 435 bool decoder_requires_restart_for_fullscreen_; | 438 bool decoder_requires_restart_for_overlay_; |
| 436 | 439 |
| 437 blink::WebMediaPlayerClient* client_; | 440 blink::WebMediaPlayerClient* client_; |
| 438 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_; | 441 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_; |
| 439 | 442 |
| 440 // WebMediaPlayer notifies the |delegate_| of playback state changes using | 443 // WebMediaPlayer notifies the |delegate_| of playback state changes using |
| 441 // |delegate_id_|; an id provided after registering with the delegate. The | 444 // |delegate_id_|; an id provided after registering with the delegate. The |
| 442 // WebMediaPlayer may also receive directives (play, pause) from the delegate | 445 // WebMediaPlayer may also receive directives (play, pause) from the delegate |
| 443 // via the WebMediaPlayerDelegate::Observer interface after registration. | 446 // via the WebMediaPlayerDelegate::Observer interface after registration. |
| 444 base::WeakPtr<WebMediaPlayerDelegate> delegate_; | 447 base::WeakPtr<WebMediaPlayerDelegate> delegate_; |
| 445 int delegate_id_; | 448 int delegate_id_; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 | 501 |
| 499 std::unique_ptr<RendererFactory> renderer_factory_; | 502 std::unique_ptr<RendererFactory> renderer_factory_; |
| 500 | 503 |
| 501 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen. | 504 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen. |
| 502 // This will be null everywhere but Android. | 505 // This will be null everywhere but Android. |
| 503 SurfaceManager* surface_manager_; | 506 SurfaceManager* surface_manager_; |
| 504 | 507 |
| 505 // For canceling ongoing surface creation requests when exiting fullscreen. | 508 // For canceling ongoing surface creation requests when exiting fullscreen. |
| 506 base::CancelableCallback<void(int)> surface_created_cb_; | 509 base::CancelableCallback<void(int)> surface_created_cb_; |
| 507 | 510 |
| 508 // The current fullscreen surface id. Populated while in fullscreen once the | 511 // The current overlay surface id. Populated while in fullscreen once the |
| 509 // surface is created. | 512 // surface is created. |
| 510 int fullscreen_surface_id_; | 513 int overlay_surface_id_; |
| 511 | 514 |
| 512 // If a surface is requested before it's finished being created, the request | 515 // If a surface is requested before it's finished being created, the request |
| 513 // is saved and satisfied once the surface is available. | 516 // is saved and satisfied once the surface is available. |
| 514 SurfaceCreatedCB pending_surface_request_cb_; | 517 SurfaceCreatedCB pending_surface_request_cb_; |
| 515 | 518 |
| 519 // Force to use SurfaceView instead of SurfaceTexture on Android. |
| 520 bool force_video_overlays_; |
| 521 |
| 516 // Suppresses calls to OnPipelineError() after destruction / shutdown has been | 522 // Suppresses calls to OnPipelineError() after destruction / shutdown has been |
| 517 // started; prevents us from spuriously logging errors that are transient or | 523 // started; prevents us from spuriously logging errors that are transient or |
| 518 // unimportant. | 524 // unimportant. |
| 519 bool suppress_destruction_errors_; | 525 bool suppress_destruction_errors_; |
| 520 | 526 |
| 521 // State indicating if it's okay to suspend or not. Updated on the first time | 527 // State indicating if it's okay to suspend or not. Updated on the first time |
| 522 // OnSuspendRequested() is called. If the state is UNKNOWN, the current frame | 528 // OnSuspendRequested() is called. If the state is UNKNOWN, the current frame |
| 523 // from the compositor will be queried to see if suspend is supported; the | 529 // from the compositor will be queried to see if suspend is supported; the |
| 524 // state will be set to YES or NO respectively if a frame is available. | 530 // state will be set to YES or NO respectively if a frame is available. |
| 525 enum class CanSuspendState { UNKNOWN, YES, NO }; | 531 enum class CanSuspendState { UNKNOWN, YES, NO }; |
| 526 CanSuspendState can_suspend_state_; | 532 CanSuspendState can_suspend_state_; |
| 527 | 533 |
| 528 // Called some-time after OnHidden() if the media was suspended in a playing | 534 // Called some-time after OnHidden() if the media was suspended in a playing |
| 529 // state as part of the call to OnHidden(). | 535 // state as part of the call to OnHidden(). |
| 530 base::OneShotTimer background_pause_timer_; | 536 base::OneShotTimer background_pause_timer_; |
| 531 | 537 |
| 532 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 538 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 533 }; | 539 }; |
| 534 | 540 |
| 535 } // namespace media | 541 } // namespace media |
| 536 | 542 |
| 537 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 543 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |