| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 // Overrides the pipeline media duration returned by | 439 // Overrides the pipeline media duration returned by |
| 440 // GetPipelineMediaDuration() for tests. | 440 // GetPipelineMediaDuration() for tests. |
| 441 void SetPipelineMediaDurationForTest(base::TimeDelta duration); | 441 void SetPipelineMediaDurationForTest(base::TimeDelta duration); |
| 442 | 442 |
| 443 // Return the pipeline media duration or the value overridden by tests. | 443 // Return the pipeline media duration or the value overridden by tests. |
| 444 base::TimeDelta GetPipelineMediaDuration() const; | 444 base::TimeDelta GetPipelineMediaDuration() const; |
| 445 | 445 |
| 446 void ReportTimeFromForegroundToFirstFrame(base::TimeTicks foreground_time, | 446 void ReportTimeFromForegroundToFirstFrame(base::TimeTicks foreground_time, |
| 447 base::TimeTicks new_frame_time); | 447 base::TimeTicks new_frame_time); |
| 448 | 448 |
| 449 // Records |duration| to the appropriate metric based on whether we're |
| 450 // handling a src= or MSE based playback. |
| 451 void RecordUnderflowDuration(base::TimeDelta duration); |
| 452 |
| 449 blink::WebLocalFrame* frame_; | 453 blink::WebLocalFrame* frame_; |
| 450 | 454 |
| 451 // The playback state last reported to |delegate_|, to avoid setting duplicate | 455 // The playback state last reported to |delegate_|, to avoid setting duplicate |
| 452 // states. | 456 // states. |
| 453 // TODO(sandersd): The delegate should be implementing deduplication. | 457 // TODO(sandersd): The delegate should be implementing deduplication. |
| 454 DelegateState delegate_state_; | 458 DelegateState delegate_state_; |
| 455 bool delegate_has_audio_; | 459 bool delegate_has_audio_; |
| 456 | 460 |
| 457 blink::WebMediaPlayer::NetworkState network_state_; | 461 blink::WebMediaPlayer::NetworkState network_state_; |
| 458 blink::WebMediaPlayer::ReadyState ready_state_; | 462 blink::WebMediaPlayer::ReadyState ready_state_; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 bool use_fallback_path_; | 656 bool use_fallback_path_; |
| 653 | 657 |
| 654 // Called sometime after the media is suspended in a playing state in | 658 // Called sometime after the media is suspended in a playing state in |
| 655 // OnFrameHidden(), causing the state to change to paused. | 659 // OnFrameHidden(), causing the state to change to paused. |
| 656 base::OneShotTimer background_pause_timer_; | 660 base::OneShotTimer background_pause_timer_; |
| 657 | 661 |
| 658 // Monitors the watch time of the played content. | 662 // Monitors the watch time of the played content. |
| 659 std::unique_ptr<WatchTimeReporter> watch_time_reporter_; | 663 std::unique_ptr<WatchTimeReporter> watch_time_reporter_; |
| 660 bool is_encrypted_; | 664 bool is_encrypted_; |
| 661 | 665 |
| 662 // Number of times we've reached BUFFERING_HAVE_NOTHING during playback. | 666 // Elapsed time since we've last reached BUFFERING_HAVE_NOTHING. |
| 663 int underflow_count_; | |
| 664 std::unique_ptr<base::ElapsedTimer> underflow_timer_; | 667 std::unique_ptr<base::ElapsedTimer> underflow_timer_; |
| 665 | 668 |
| 666 // Used to track loading progress, used by IsPrerollAttemptNeeded(). | 669 // Used to track loading progress, used by IsPrerollAttemptNeeded(). |
| 667 // |preroll_attempt_pending_| indicates that the clock has been reset | 670 // |preroll_attempt_pending_| indicates that the clock has been reset |
| 668 // (awaiting a resume to start), while |preroll_attempt_start_time_| tracks | 671 // (awaiting a resume to start), while |preroll_attempt_start_time_| tracks |
| 669 // when a preroll attempt began. | 672 // when a preroll attempt began. |
| 670 bool preroll_attempt_pending_; | 673 bool preroll_attempt_pending_; |
| 671 base::TimeTicks preroll_attempt_start_time_; | 674 base::TimeTicks preroll_attempt_start_time_; |
| 672 | 675 |
| 673 std::unique_ptr<base::TickClock> tick_clock_; | 676 std::unique_ptr<base::TickClock> tick_clock_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 699 | 702 |
| 700 // Pipeline media duration overridden by tests. | 703 // Pipeline media duration overridden by tests. |
| 701 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_; | 704 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_; |
| 702 | 705 |
| 703 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 706 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 704 }; | 707 }; |
| 705 | 708 |
| 706 } // namespace media | 709 } // namespace media |
| 707 | 710 |
| 708 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 711 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |