| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/cancelable_callback.h" |
| 14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| 17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 19 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
| 20 #include "base/timer/timer.h" | 21 #include "base/timer/timer.h" |
| 21 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 22 #include "media/base/media_tracks.h" | 23 #include "media/base/media_tracks.h" |
| 23 #include "media/base/pipeline_impl.h" | 24 #include "media/base/pipeline_impl.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 void DoLoad(LoadType load_type, | 254 void DoLoad(LoadType load_type, |
| 254 const blink::WebURL& url, | 255 const blink::WebURL& url, |
| 255 CORSMode cors_mode); | 256 CORSMode cors_mode); |
| 256 | 257 |
| 257 // Called after asynchronous initialization of a data source completed. | 258 // Called after asynchronous initialization of a data source completed. |
| 258 void DataSourceInitialized(bool success); | 259 void DataSourceInitialized(bool success); |
| 259 | 260 |
| 260 // Called when the data source is downloading or paused. | 261 // Called when the data source is downloading or paused. |
| 261 void NotifyDownloading(bool is_downloading); | 262 void NotifyDownloading(bool is_downloading); |
| 262 | 263 |
| 264 // Called by SurfaceManager when a surface is created. |
| 265 void OnSurfaceCreated(int surface_id); |
| 266 |
| 267 // Called by GpuVideoDecoder on Android to request a surface to render to (if |
| 268 // necessary). |
| 263 void OnSurfaceRequested(const SurfaceCreatedCB& surface_created_cb); | 269 void OnSurfaceRequested(const SurfaceCreatedCB& surface_created_cb); |
| 264 | 270 |
| 265 // Creates a Renderer via the |renderer_factory_|. | 271 // Creates a Renderer via the |renderer_factory_|. |
| 266 std::unique_ptr<Renderer> CreateRenderer(); | 272 std::unique_ptr<Renderer> CreateRenderer(); |
| 267 | 273 |
| 268 // Finishes starting the pipeline due to a call to load(). | 274 // Finishes starting the pipeline due to a call to load(). |
| 269 void StartPipeline(); | 275 void StartPipeline(); |
| 270 | 276 |
| 271 // Helpers that set the network/ready state and notifies the client if | 277 // Helpers that set the network/ready state and notifies the client if |
| 272 // they've changed. | 278 // they've changed. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 422 |
| 417 // Tracks whether to issue time changed notifications during buffering state | 423 // Tracks whether to issue time changed notifications during buffering state |
| 418 // changes. | 424 // changes. |
| 419 bool should_notify_time_changed_; | 425 bool should_notify_time_changed_; |
| 420 | 426 |
| 421 bool fullscreen_; | 427 bool fullscreen_; |
| 422 | 428 |
| 423 // Whether the current decoder requires a restart on fullscreen transitions. | 429 // Whether the current decoder requires a restart on fullscreen transitions. |
| 424 bool decoder_requires_restart_for_fullscreen_; | 430 bool decoder_requires_restart_for_fullscreen_; |
| 425 | 431 |
| 426 // What to return from supportsOverlayFullscreenVideo(). This is usually | |
| 427 // equal to |decoder_requires_restart_for_fullscreen_| except that it doesn't | |
| 428 // change while we're in fullscreen. See supportsOverlayFullscreenVideo(). | |
| 429 bool supports_overlay_fullscreen_video_; | |
| 430 | |
| 431 blink::WebMediaPlayerClient* client_; | 432 blink::WebMediaPlayerClient* client_; |
| 432 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_; | 433 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_; |
| 433 | 434 |
| 434 // WebMediaPlayer notifies the |delegate_| of playback state changes using | 435 // WebMediaPlayer notifies the |delegate_| of playback state changes using |
| 435 // |delegate_id_|; an id provided after registering with the delegate. The | 436 // |delegate_id_|; an id provided after registering with the delegate. The |
| 436 // WebMediaPlayer may also receive directives (play, pause) from the delegate | 437 // WebMediaPlayer may also receive directives (play, pause) from the delegate |
| 437 // via the WebMediaPlayerDelegate::Observer interface after registration. | 438 // via the WebMediaPlayerDelegate::Observer interface after registration. |
| 438 base::WeakPtr<WebMediaPlayerDelegate> delegate_; | 439 base::WeakPtr<WebMediaPlayerDelegate> delegate_; |
| 439 int delegate_id_; | 440 int delegate_id_; |
| 440 | 441 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 // for a transient sound. Playout volume is derived by volume * multiplier. | 490 // for a transient sound. Playout volume is derived by volume * multiplier. |
| 490 double volume_; | 491 double volume_; |
| 491 double volume_multiplier_; | 492 double volume_multiplier_; |
| 492 | 493 |
| 493 std::unique_ptr<RendererFactory> renderer_factory_; | 494 std::unique_ptr<RendererFactory> renderer_factory_; |
| 494 | 495 |
| 495 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen. | 496 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen. |
| 496 // This will be null everywhere but Android. | 497 // This will be null everywhere but Android. |
| 497 SurfaceManager* surface_manager_; | 498 SurfaceManager* surface_manager_; |
| 498 | 499 |
| 500 // For canceling ongoing surface creation requests when exiting fullscreen. |
| 501 base::CancelableCallback<void(int)> surface_created_cb_; |
| 502 |
| 503 // The current fullscreen surface id. Populated while in fullscreen once the |
| 504 // surface is created. |
| 505 int fullscreen_surface_id_; |
| 506 |
| 507 // If a surface is requested before it's finished being created, the request |
| 508 // is saved and satisfied once the surface is available. |
| 509 SurfaceCreatedCB pending_surface_request_cb_; |
| 510 |
| 499 // Suppresses calls to OnPipelineError() after destruction / shutdown has been | 511 // Suppresses calls to OnPipelineError() after destruction / shutdown has been |
| 500 // started; prevents us from spuriously logging errors that are transient or | 512 // started; prevents us from spuriously logging errors that are transient or |
| 501 // unimportant. | 513 // unimportant. |
| 502 bool suppress_destruction_errors_; | 514 bool suppress_destruction_errors_; |
| 503 | 515 |
| 504 // State indicating if it's okay to suspend or not. Updated on the first time | 516 // State indicating if it's okay to suspend or not. Updated on the first time |
| 505 // OnSuspendRequested() is called. If the state is UNKNOWN, the current frame | 517 // OnSuspendRequested() is called. If the state is UNKNOWN, the current frame |
| 506 // from the compositor will be queried to see if suspend is supported; the | 518 // from the compositor will be queried to see if suspend is supported; the |
| 507 // state will be set to YES or NO respectively if a frame is available. | 519 // state will be set to YES or NO respectively if a frame is available. |
| 508 enum class CanSuspendState { UNKNOWN, YES, NO }; | 520 enum class CanSuspendState { UNKNOWN, YES, NO }; |
| 509 CanSuspendState can_suspend_state_; | 521 CanSuspendState can_suspend_state_; |
| 510 | 522 |
| 511 // Called some-time after OnHidden() if the media was suspended in a playing | 523 // Called some-time after OnHidden() if the media was suspended in a playing |
| 512 // state as part of the call to OnHidden(). | 524 // state as part of the call to OnHidden(). |
| 513 base::OneShotTimer background_pause_timer_; | 525 base::OneShotTimer background_pause_timer_; |
| 514 | 526 |
| 515 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 527 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 516 }; | 528 }; |
| 517 | 529 |
| 518 } // namespace media | 530 } // namespace media |
| 519 | 531 |
| 520 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 532 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |