Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: media/blink/webmediaplayer_impl.h

Issue 2796193002: fix canplaythrough (Closed)
Patch Set: kSpecCompliantCanPlayThrough Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 // Elapsed time since we've last reached BUFFERING_HAVE_NOTHING. 691 // Elapsed time since we've last reached BUFFERING_HAVE_NOTHING.
679 std::unique_ptr<base::ElapsedTimer> underflow_timer_; 692 std::unique_ptr<base::ElapsedTimer> underflow_timer_;
680 693
681 // Used to track loading progress, used by IsPrerollAttemptNeeded(). 694 // Used to track loading progress, used by IsPrerollAttemptNeeded().
682 // |preroll_attempt_pending_| indicates that the clock has been reset 695 // |preroll_attempt_pending_| indicates that the clock has been reset
683 // (awaiting a resume to start), while |preroll_attempt_start_time_| tracks 696 // (awaiting a resume to start), while |preroll_attempt_start_time_| tracks
684 // when a preroll attempt began. 697 // when a preroll attempt began.
685 bool preroll_attempt_pending_; 698 bool preroll_attempt_pending_;
686 base::TimeTicks preroll_attempt_start_time_; 699 base::TimeTicks preroll_attempt_start_time_;
687 700
688 std::unique_ptr<base::TickClock> tick_clock_;
689
690 // Monitors the player events. 701 // Monitors the player events.
691 base::WeakPtr<MediaObserver> observer_; 702 base::WeakPtr<MediaObserver> observer_;
692 703
693 // The maximum video keyframe distance that allows triggering background 704 // The maximum video keyframe distance that allows triggering background
694 // playback optimizations (non-MSE). 705 // playback optimizations (non-MSE).
695 base::TimeDelta max_keyframe_distance_to_disable_background_video_; 706 base::TimeDelta max_keyframe_distance_to_disable_background_video_;
696 707
697 // The maximum video keyframe distance that allows triggering background 708 // The maximum video keyframe distance that allows triggering background
698 // playback optimizations (MSE). 709 // playback optimizations (MSE).
699 base::TimeDelta max_keyframe_distance_to_disable_background_video_mse_; 710 base::TimeDelta max_keyframe_distance_to_disable_background_video_mse_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 base::CancelableCallback<void(base::TimeTicks)> frame_time_report_cb_; 743 base::CancelableCallback<void(base::TimeTicks)> frame_time_report_cb_;
733 744
734 bool initial_video_height_recorded_ = false; 745 bool initial_video_height_recorded_ = false;
735 746
736 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 747 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
737 }; 748 };
738 749
739 } // namespace media 750 } // namespace media
740 751
741 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 752 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW
« no previous file with comments | « media/blink/buffered_data_source_host_impl_unittest.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698