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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 class GLES2Interface; | 65 class GLES2Interface; |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 namespace media { | 69 namespace media { |
70 class ChunkDemuxer; | 70 class ChunkDemuxer; |
71 class GpuVideoAcceleratorFactories; | 71 class GpuVideoAcceleratorFactories; |
72 class MediaLog; | 72 class MediaLog; |
73 class UrlIndex; | 73 class UrlIndex; |
74 class VideoFrameCompositor; | 74 class VideoFrameCompositor; |
| 75 class WatchTimeReporter; |
75 class WebAudioSourceProviderImpl; | 76 class WebAudioSourceProviderImpl; |
76 class WebMediaPlayerDelegate; | 77 class WebMediaPlayerDelegate; |
77 class WebTextTrackImpl; | 78 class WebTextTrackImpl; |
78 | 79 |
79 // The canonical implementation of blink::WebMediaPlayer that's backed by | 80 // The canonical implementation of blink::WebMediaPlayer that's backed by |
80 // Pipeline. Handles normal resource loading, Media Source, and | 81 // Pipeline. Handles normal resource loading, Media Source, and |
81 // Encrypted Media. | 82 // Encrypted Media. |
82 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl | 83 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl |
83 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), | 84 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), |
84 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), | 85 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 // using for video playback. Called by |memory_usage_reporting_timer_|. | 343 // using for video playback. Called by |memory_usage_reporting_timer_|. |
343 // Memory usage reporting is done in two steps, because |demuxer_| must be | 344 // Memory usage reporting is done in two steps, because |demuxer_| must be |
344 // accessed on the media thread. | 345 // accessed on the media thread. |
345 void ReportMemoryUsage(); | 346 void ReportMemoryUsage(); |
346 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); | 347 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); |
347 | 348 |
348 // Called during OnHidden() when we want a suspended player to enter the | 349 // Called during OnHidden() when we want a suspended player to enter the |
349 // paused state after some idle timeout. | 350 // paused state after some idle timeout. |
350 void ScheduleIdlePauseTimer(); | 351 void ScheduleIdlePauseTimer(); |
351 | 352 |
| 353 void CreateWatchTimeReporter(); |
| 354 |
352 blink::WebLocalFrame* frame_; | 355 blink::WebLocalFrame* frame_; |
353 | 356 |
354 // The playback state last reported to |delegate_|, to avoid setting duplicate | 357 // The playback state last reported to |delegate_|, to avoid setting duplicate |
355 // states. (Which can have undesired effects like resetting the idle timer.) | 358 // states. (Which can have undesired effects like resetting the idle timer.) |
356 DelegateState delegate_state_; | 359 DelegateState delegate_state_; |
357 | 360 |
358 // Set when OnSuspendRequested() is called with |must_suspend| unset. | 361 // Set when OnSuspendRequested() is called with |must_suspend| unset. |
359 bool is_idle_; | 362 bool is_idle_; |
360 | 363 |
361 // Set when OnSuspendRequested() is called with |must_suspend| set. | 364 // Set when OnSuspendRequested() is called with |must_suspend| set. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 // OnSuspendRequested() is called. If the state is UNKNOWN, the current frame | 531 // OnSuspendRequested() is called. If the state is UNKNOWN, the current frame |
529 // from the compositor will be queried to see if suspend is supported; the | 532 // from the compositor will be queried to see if suspend is supported; the |
530 // state will be set to YES or NO respectively if a frame is available. | 533 // state will be set to YES or NO respectively if a frame is available. |
531 enum class CanSuspendState { UNKNOWN, YES, NO }; | 534 enum class CanSuspendState { UNKNOWN, YES, NO }; |
532 CanSuspendState can_suspend_state_; | 535 CanSuspendState can_suspend_state_; |
533 | 536 |
534 // Called some-time after OnHidden() if the media was suspended in a playing | 537 // Called some-time after OnHidden() if the media was suspended in a playing |
535 // state as part of the call to OnHidden(). | 538 // state as part of the call to OnHidden(). |
536 base::OneShotTimer background_pause_timer_; | 539 base::OneShotTimer background_pause_timer_; |
537 | 540 |
| 541 // Monitors the watch time of the played content. |
| 542 std::unique_ptr<WatchTimeReporter> watch_time_reporter_; |
| 543 bool is_encrypted_; |
| 544 |
538 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 545 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
539 }; | 546 }; |
540 | 547 |
541 } // namespace media | 548 } // namespace media |
542 | 549 |
543 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 550 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |