| 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 // Overrides the pipeline media duration returned by | 434 // Overrides the pipeline media duration returned by |
| 435 // GetPipelineMediaDuration() for tests. | 435 // GetPipelineMediaDuration() for tests. |
| 436 void SetPipelineMediaDurationForTest(base::TimeDelta duration); | 436 void SetPipelineMediaDurationForTest(base::TimeDelta duration); |
| 437 | 437 |
| 438 // Return the pipeline media duration or the value overridden by tests. | 438 // Return the pipeline media duration or the value overridden by tests. |
| 439 base::TimeDelta GetPipelineMediaDuration() const; | 439 base::TimeDelta GetPipelineMediaDuration() const; |
| 440 | 440 |
| 441 void ReportTimeFromForegroundToFirstFrame(base::TimeTicks foreground_time, | 441 void ReportTimeFromForegroundToFirstFrame(base::TimeTicks foreground_time, |
| 442 base::TimeTicks new_frame_time); | 442 base::TimeTicks new_frame_time); |
| 443 | 443 |
| 444 // Records |duration| to the appropriate metric based on whether we're |
| 445 // handling a src= or MSE based playback. |
| 446 void RecordUnderflowDuration(base::TimeDelta duration); |
| 447 |
| 444 blink::WebLocalFrame* frame_; | 448 blink::WebLocalFrame* frame_; |
| 445 | 449 |
| 446 // The playback state last reported to |delegate_|, to avoid setting duplicate | 450 // The playback state last reported to |delegate_|, to avoid setting duplicate |
| 447 // states. | 451 // states. |
| 448 // TODO(sandersd): The delegate should be implementing deduplication. | 452 // TODO(sandersd): The delegate should be implementing deduplication. |
| 449 DelegateState delegate_state_; | 453 DelegateState delegate_state_; |
| 450 bool delegate_has_audio_; | 454 bool delegate_has_audio_; |
| 451 | 455 |
| 452 blink::WebMediaPlayer::NetworkState network_state_; | 456 blink::WebMediaPlayer::NetworkState network_state_; |
| 453 blink::WebMediaPlayer::ReadyState ready_state_; | 457 blink::WebMediaPlayer::ReadyState ready_state_; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 bool use_fallback_path_; | 647 bool use_fallback_path_; |
| 644 | 648 |
| 645 // Called sometime after the media is suspended in a playing state in | 649 // Called sometime after the media is suspended in a playing state in |
| 646 // OnFrameHidden(), causing the state to change to paused. | 650 // OnFrameHidden(), causing the state to change to paused. |
| 647 base::OneShotTimer background_pause_timer_; | 651 base::OneShotTimer background_pause_timer_; |
| 648 | 652 |
| 649 // Monitors the watch time of the played content. | 653 // Monitors the watch time of the played content. |
| 650 std::unique_ptr<WatchTimeReporter> watch_time_reporter_; | 654 std::unique_ptr<WatchTimeReporter> watch_time_reporter_; |
| 651 bool is_encrypted_; | 655 bool is_encrypted_; |
| 652 | 656 |
| 653 // Number of times we've reached BUFFERING_HAVE_NOTHING during playback. | 657 // Elapsed time since we've last reached BUFFERING_HAVE_NOTHING. |
| 654 int underflow_count_; | |
| 655 std::unique_ptr<base::ElapsedTimer> underflow_timer_; | 658 std::unique_ptr<base::ElapsedTimer> underflow_timer_; |
| 656 | 659 |
| 657 // Used to track loading progress, used by IsPrerollAttemptNeeded(). | 660 // Used to track loading progress, used by IsPrerollAttemptNeeded(). |
| 658 // |preroll_attempt_pending_| indicates that the clock has been reset | 661 // |preroll_attempt_pending_| indicates that the clock has been reset |
| 659 // (awaiting a resume to start), while |preroll_attempt_start_time_| tracks | 662 // (awaiting a resume to start), while |preroll_attempt_start_time_| tracks |
| 660 // when a preroll attempt began. | 663 // when a preroll attempt began. |
| 661 bool preroll_attempt_pending_; | 664 bool preroll_attempt_pending_; |
| 662 base::TimeTicks preroll_attempt_start_time_; | 665 base::TimeTicks preroll_attempt_start_time_; |
| 663 | 666 |
| 664 std::unique_ptr<base::TickClock> tick_clock_; | 667 std::unique_ptr<base::TickClock> tick_clock_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 683 | 686 |
| 684 // Pipeline media duration overridden by tests. | 687 // Pipeline media duration overridden by tests. |
| 685 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_; | 688 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_; |
| 686 | 689 |
| 687 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 690 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 688 }; | 691 }; |
| 689 | 692 |
| 690 } // namespace media | 693 } // namespace media |
| 691 | 694 |
| 692 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 695 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |