Chromium Code Reviews| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 | 322 |
| 323 // Inspects the current playback state and: | 323 // Inspects the current playback state and: |
| 324 // - notifies |delegate_|, | 324 // - notifies |delegate_|, |
| 325 // - toggles the memory usage reporting timer, and | 325 // - toggles the memory usage reporting timer, and |
| 326 // - toggles suspend/resume as necessary. | 326 // - toggles suspend/resume as necessary. |
| 327 // | 327 // |
| 328 // This method should be called any time its dependent values change. These | 328 // This method should be called any time its dependent values change. These |
| 329 // are: | 329 // are: |
| 330 // - isRemote(), | 330 // - isRemote(), |
| 331 // - hasVideo(), | 331 // - hasVideo(), |
| 332 // - delegate_->IsHidden(), | 332 // - delegate_->IsBackground(), |
|
sandersd (OOO until July 31)
2017/01/24 23:35:48
This didn't get changed in this CL.
whywhat
2017/01/24 23:50:54
Should be delegate_->IsFrameHidden() though, updat
sandersd (OOO until July 31)
2017/01/24 23:55:25
If you don't do that now, I'll give it a try next
| |
| 333 // - network_state_, ready_state_, | 333 // - network_state_, ready_state_, |
| 334 // - is_idle_, must_suspend_, | 334 // - is_idle_, must_suspend_, |
| 335 // - paused_, ended_, | 335 // - paused_, ended_, |
| 336 // - pending_suspend_resume_cycle_, | 336 // - pending_suspend_resume_cycle_, |
| 337 void UpdatePlayState(); | 337 void UpdatePlayState(); |
| 338 | 338 |
| 339 // Methods internal to UpdatePlayState(). | 339 // Methods internal to UpdatePlayState(). |
| 340 PlayState UpdatePlayState_ComputePlayState(bool is_remote, | 340 PlayState UpdatePlayState_ComputePlayState(bool is_remote, |
| 341 bool is_streaming, | 341 bool is_streaming, |
| 342 bool is_suspended, | 342 bool is_suspended, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 361 // since then. | 361 // since then. |
| 362 // | 362 // |
| 363 // This is used to delay suspension long enough for preroll to complete, which | 363 // This is used to delay suspension long enough for preroll to complete, which |
| 364 // is necessay because play() will not be called before HaveFutureData (and | 364 // is necessay because play() will not be called before HaveFutureData (and |
| 365 // thus we think we are idle forever). | 365 // thus we think we are idle forever). |
| 366 bool IsPrerollAttemptNeeded(); | 366 bool IsPrerollAttemptNeeded(); |
| 367 | 367 |
| 368 void CreateWatchTimeReporter(); | 368 void CreateWatchTimeReporter(); |
| 369 | 369 |
| 370 // Returns true if the player is hidden. | 370 // Returns true if the player is hidden. |
| 371 bool IsHidden() const; | 371 bool IsBackground() const; |
|
sandersd (OOO until July 31)
2017/01/24 23:35:48
Nit: I prefer IsBackgrounded(), grammatically.
whywhat
2017/01/24 23:50:54
Right, I was wondering about that :) Done.
| |
| 372 | 372 |
| 373 // Returns true if the player's source is streaming. | 373 // Returns true if the player's source is streaming. |
| 374 bool IsStreaming() const; | 374 bool IsStreaming() const; |
| 375 | 375 |
| 376 // Return whether |pipeline_metadata_| is compatible with an overlay. This | 376 // Return whether |pipeline_metadata_| is compatible with an overlay. This |
| 377 // is intended for android. | 377 // is intended for android. |
| 378 bool DoesOverlaySupportMetadata() const; | 378 bool DoesOverlaySupportMetadata() const; |
| 379 | 379 |
| 380 // Whether the video should be paused when hidden. Uses metadata so has | 380 // Whether the video should be paused when hidden. Uses metadata so has |
| 381 // meaning only after the pipeline has started, otherwise returns false. | 381 // meaning only after the pipeline has started, otherwise returns false. |
| 382 // Doesn't check if the video can actually be paused depending on the | 382 // Doesn't check if the video can actually be paused depending on the |
| 383 // pipeline's state. | 383 // pipeline's state. |
| 384 bool ShouldPauseVideoWhenHidden() const; | 384 bool ShouldPauseVideoWhenBackground() const; |
| 385 | 385 |
| 386 // Whether the video track should be disabled when hidden. Uses metadata so | 386 // Whether the video track should be disabled when hidden. Uses metadata so |
| 387 // has meaning only after the pipeline has started, otherwise returns false. | 387 // has meaning only after the pipeline has started, otherwise returns false. |
| 388 // Doesn't check if the video track can actually be disabled depending on the | 388 // Doesn't check if the video track can actually be disabled depending on the |
| 389 // pipeline's state. | 389 // pipeline's state. |
| 390 bool ShouldDisableVideoWhenHidden() const; | 390 bool ShouldDisableVideoWhenBackground() const; |
| 391 | 391 |
| 392 // Whether the video is suitable for background playback optimizations (either | 392 // Whether the video is suitable for background playback optimizations (either |
| 393 // pausing it or disabling the video track). Uses metadata so has meaning only | 393 // pausing it or disabling the video track). Uses metadata so has meaning only |
| 394 // after the pipeline has started, otherwise returns false. | 394 // after the pipeline has started, otherwise returns false. |
| 395 // The logical OR between the two methods above that is also used as their | 395 // The logical OR between the two methods above that is also used as their |
| 396 // common implementation. | 396 // common implementation. |
| 397 bool IsBackgroundOptimizationCandidate() const; | 397 bool IsBackgroundOptimizationCandidate() const; |
| 398 | 398 |
| 399 // If enabling or disabling background video optimization has been delayed, | 399 // If enabling or disabling background video optimization has been delayed, |
| 400 // because of the pipeline not running, seeking or resuming, this method | 400 // because of the pipeline not running, seeking or resuming, this method |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 686 | 686 |
| 687 // Pipeline media duration overridden by tests. | 687 // Pipeline media duration overridden by tests. |
| 688 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_; | 688 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_; |
| 689 | 689 |
| 690 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 690 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 691 }; | 691 }; |
| 692 | 692 |
| 693 } // namespace media | 693 } // namespace media |
| 694 | 694 |
| 695 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 695 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |