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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 // Return the pipeline media duration or the value overridden by tests. | 450 // Return the pipeline media duration or the value overridden by tests. |
451 base::TimeDelta GetPipelineMediaDuration() const; | 451 base::TimeDelta GetPipelineMediaDuration() const; |
452 | 452 |
453 void ReportTimeFromForegroundToFirstFrame(base::TimeTicks foreground_time, | 453 void ReportTimeFromForegroundToFirstFrame(base::TimeTicks foreground_time, |
454 base::TimeTicks new_frame_time); | 454 base::TimeTicks new_frame_time); |
455 | 455 |
456 // Records |duration| to the appropriate metric based on whether we're | 456 // Records |duration| to the appropriate metric based on whether we're |
457 // handling a src= or MSE based playback. | 457 // handling a src= or MSE based playback. |
458 void RecordUnderflowDuration(base::TimeDelta duration); | 458 void RecordUnderflowDuration(base::TimeDelta duration); |
459 | 459 |
| 460 // Called by the data source when loading progresses. |
| 461 // Can be called quite often. |
| 462 void OnProgress(); |
| 463 |
| 464 // Returns true when we estimate that we can play the rest of the media |
| 465 // without buffering. |
| 466 bool CanPlayThrough(); |
| 467 |
460 // Records |natural_size| to MediaLog and video height to UMA. | 468 // Records |natural_size| to MediaLog and video height to UMA. |
461 void RecordVideoNaturalSize(const gfx::Size& natural_size); | 469 void RecordVideoNaturalSize(const gfx::Size& natural_size); |
462 | 470 |
| 471 // Takes ownership of |tick_clock| |
| 472 void SetTickClockForTest(base::TickClock* tick_clock); |
| 473 |
463 blink::WebLocalFrame* frame_; | 474 blink::WebLocalFrame* frame_; |
464 | 475 |
465 // The playback state last reported to |delegate_|, to avoid setting duplicate | 476 // The playback state last reported to |delegate_|, to avoid setting duplicate |
466 // states. | 477 // states. |
467 // TODO(sandersd): The delegate should be implementing deduplication. | 478 // TODO(sandersd): The delegate should be implementing deduplication. |
468 DelegateState delegate_state_; | 479 DelegateState delegate_state_; |
469 bool delegate_has_audio_; | 480 bool delegate_has_audio_; |
470 | 481 |
471 blink::WebMediaPlayer::NetworkState network_state_; | 482 blink::WebMediaPlayer::NetworkState network_state_; |
472 blink::WebMediaPlayer::ReadyState ready_state_; | 483 blink::WebMediaPlayer::ReadyState ready_state_; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 // |chunk_demuxer_| is used for Media Source resource loads. | 588 // |chunk_demuxer_| is used for Media Source resource loads. |
578 // | 589 // |
579 // |demuxer_| will contain the appropriate demuxer based on which resource | 590 // |demuxer_| will contain the appropriate demuxer based on which resource |
580 // load strategy we're using. | 591 // load strategy we're using. |
581 std::unique_ptr<MultibufferDataSource> data_source_; | 592 std::unique_ptr<MultibufferDataSource> data_source_; |
582 std::unique_ptr<Demuxer> demuxer_; | 593 std::unique_ptr<Demuxer> demuxer_; |
583 ChunkDemuxer* chunk_demuxer_; | 594 ChunkDemuxer* chunk_demuxer_; |
584 | 595 |
585 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 596 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
586 | 597 |
| 598 std::unique_ptr<base::TickClock> tick_clock_; |
| 599 |
587 BufferedDataSourceHostImpl buffered_data_source_host_; | 600 BufferedDataSourceHostImpl buffered_data_source_host_; |
588 linked_ptr<UrlIndex> url_index_; | 601 linked_ptr<UrlIndex> url_index_; |
589 | 602 |
590 // Video rendering members. | 603 // Video rendering members. |
591 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 604 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
592 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. | 605 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. |
593 SkCanvasVideoRenderer skcanvas_video_renderer_; | 606 SkCanvasVideoRenderer skcanvas_video_renderer_; |
594 | 607 |
595 // The compositor layer for displaying the video content when using composited | 608 // The compositor layer for displaying the video content when using composited |
596 // playback. | 609 // playback. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 // Elapsed time since we've last reached BUFFERING_HAVE_NOTHING. | 690 // Elapsed time since we've last reached BUFFERING_HAVE_NOTHING. |
678 std::unique_ptr<base::ElapsedTimer> underflow_timer_; | 691 std::unique_ptr<base::ElapsedTimer> underflow_timer_; |
679 | 692 |
680 // Used to track loading progress, used by IsPrerollAttemptNeeded(). | 693 // Used to track loading progress, used by IsPrerollAttemptNeeded(). |
681 // |preroll_attempt_pending_| indicates that the clock has been reset | 694 // |preroll_attempt_pending_| indicates that the clock has been reset |
682 // (awaiting a resume to start), while |preroll_attempt_start_time_| tracks | 695 // (awaiting a resume to start), while |preroll_attempt_start_time_| tracks |
683 // when a preroll attempt began. | 696 // when a preroll attempt began. |
684 bool preroll_attempt_pending_; | 697 bool preroll_attempt_pending_; |
685 base::TimeTicks preroll_attempt_start_time_; | 698 base::TimeTicks preroll_attempt_start_time_; |
686 | 699 |
687 std::unique_ptr<base::TickClock> tick_clock_; | |
688 | |
689 // Monitors the player events. | 700 // Monitors the player events. |
690 base::WeakPtr<MediaObserver> observer_; | 701 base::WeakPtr<MediaObserver> observer_; |
691 | 702 |
692 // The maximum video keyframe distance that allows triggering background | 703 // The maximum video keyframe distance that allows triggering background |
693 // playback optimizations (non-MSE). | 704 // playback optimizations (non-MSE). |
694 base::TimeDelta max_keyframe_distance_to_disable_background_video_; | 705 base::TimeDelta max_keyframe_distance_to_disable_background_video_; |
695 | 706 |
696 // The maximum video keyframe distance that allows triggering background | 707 // The maximum video keyframe distance that allows triggering background |
697 // playback optimizations (MSE). | 708 // playback optimizations (MSE). |
698 base::TimeDelta max_keyframe_distance_to_disable_background_video_mse_; | 709 base::TimeDelta max_keyframe_distance_to_disable_background_video_mse_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 base::CancelableCallback<void(base::TimeTicks)> frame_time_report_cb_; | 742 base::CancelableCallback<void(base::TimeTicks)> frame_time_report_cb_; |
732 | 743 |
733 bool initial_video_height_recorded_ = false; | 744 bool initial_video_height_recorded_ = false; |
734 | 745 |
735 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 746 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
736 }; | 747 }; |
737 | 748 |
738 } // namespace media | 749 } // namespace media |
739 | 750 |
740 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 751 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |