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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 // Return the pipeline media duration or the value overridden by tests. | 451 // Return the pipeline media duration or the value overridden by tests. |
452 base::TimeDelta GetPipelineMediaDuration() const; | 452 base::TimeDelta GetPipelineMediaDuration() const; |
453 | 453 |
454 void ReportTimeFromForegroundToFirstFrame(base::TimeTicks foreground_time, | 454 void ReportTimeFromForegroundToFirstFrame(base::TimeTicks foreground_time, |
455 base::TimeTicks new_frame_time); | 455 base::TimeTicks new_frame_time); |
456 | 456 |
457 // Records |duration| to the appropriate metric based on whether we're | 457 // Records |duration| to the appropriate metric based on whether we're |
458 // handling a src= or MSE based playback. | 458 // handling a src= or MSE based playback. |
459 void RecordUnderflowDuration(base::TimeDelta duration); | 459 void RecordUnderflowDuration(base::TimeDelta duration); |
460 | 460 |
| 461 // Indicates why ShouldPauseVideoWhenHidden() or |
| 462 // ShouldDisableVideoWhenHidden() failed or succeeded for metrics recording. |
| 463 // Must be in sync with the MediaBackgroundOptimizationCandidacyResult enum |
| 464 // in histograms.xml. |
| 465 enum BackgroundOptimizationResult { |
| 466 // Was optimized because shorter than the threshold. |
| 467 SUCCESS_FOR_DURATION, |
| 468 // Was optimized because keyframe distance is shorter than the threshold. |
| 469 SUCCESS_FOR_KEYFRAME_DISTANCE, |
| 470 // Was optimized because it doesn't have audio ignoring the threshold. |
| 471 SUCCESS_FOR_VIDEO_ONLY, |
| 472 // Wasn't optimized because keyframe distance is too big. |
| 473 FAIL_FOR_KEYFRAME_DISTANCE, |
| 474 // Wasn't optimized because is being played remotely. |
| 475 FAIL_FOR_REMOTE, |
| 476 // Wasn't optimized because is a streaming video. |
| 477 FAIL_FOR_STREAMING, |
| 478 |
| 479 // Must be the last item and set to the previous item's value. |
| 480 RESULT_MAX = FAIL_FOR_STREAMING |
| 481 }; |
| 482 |
| 483 // Reports the result of each background optimization check. |
| 484 // Figures the right bucket based on whether the video has audio or not. |
| 485 void ReportBackgroundOptimizationResult( |
| 486 BackgroundOptimizationResult result) const; |
| 487 |
461 blink::WebLocalFrame* frame_; | 488 blink::WebLocalFrame* frame_; |
462 | 489 |
463 // The playback state last reported to |delegate_|, to avoid setting duplicate | 490 // The playback state last reported to |delegate_|, to avoid setting duplicate |
464 // states. | 491 // states. |
465 // TODO(sandersd): The delegate should be implementing deduplication. | 492 // TODO(sandersd): The delegate should be implementing deduplication. |
466 DelegateState delegate_state_; | 493 DelegateState delegate_state_; |
467 bool delegate_has_audio_; | 494 bool delegate_has_audio_; |
468 | 495 |
469 blink::WebMediaPlayer::NetworkState network_state_; | 496 blink::WebMediaPlayer::NetworkState network_state_; |
470 blink::WebMediaPlayer::ReadyState ready_state_; | 497 blink::WebMediaPlayer::ReadyState ready_state_; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 base::TimeDelta last_uploaded_frame_timestamp_; | 747 base::TimeDelta last_uploaded_frame_timestamp_; |
721 | 748 |
722 base::CancelableCallback<void(base::TimeTicks)> frame_time_report_cb_; | 749 base::CancelableCallback<void(base::TimeTicks)> frame_time_report_cb_; |
723 | 750 |
724 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 751 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
725 }; | 752 }; |
726 | 753 |
727 } // namespace media | 754 } // namespace media |
728 | 755 |
729 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 756 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |