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

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

Issue 2160963002: Add watch time metrics for HTML5 media playback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 4 years, 4 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
« no previous file with comments | « media/blink/watch_time_reporter_unittest.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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_
OLDNEW
« no previous file with comments | « media/blink/watch_time_reporter_unittest.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698