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

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

Issue 2039793005: Don't resume paused media. Don't resume playing media after timeout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reimplement. Add tests. Created 4 years, 6 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 | « no previous file | media/blink/webmediaplayer_impl.cc » ('j') | media/blink/webmediaplayer_impl.cc » ('J')
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>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/linked_ptr.h" 16 #include "base/memory/linked_ptr.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
20 #include "base/timer/timer.h"
20 #include "build/build_config.h" 21 #include "build/build_config.h"
21 #include "media/base/media_tracks.h" 22 #include "media/base/media_tracks.h"
22 #include "media/base/pipeline_impl.h" 23 #include "media/base/pipeline_impl.h"
23 #include "media/base/renderer_factory.h" 24 #include "media/base/renderer_factory.h"
24 #include "media/base/surface_manager.h" 25 #include "media/base/surface_manager.h"
25 #include "media/base/text_track.h" 26 #include "media/base/text_track.h"
26 #include "media/blink/buffered_data_source.h" 27 #include "media/blink/buffered_data_source.h"
27 #include "media/blink/buffered_data_source_host_impl.h" 28 #include "media/blink/buffered_data_source_host_impl.h"
28 #include "media/blink/media_blink_export.h" 29 #include "media/blink/media_blink_export.h"
29 #include "media/blink/multibuffer_data_source.h" 30 #include "media/blink/multibuffer_data_source.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // - hasVideo(), 311 // - hasVideo(),
311 // - delegate_->IsHidden(), 312 // - delegate_->IsHidden(),
312 // - network_state_, ready_state_, 313 // - network_state_, ready_state_,
313 // - is_idle_, must_suspend_, 314 // - is_idle_, must_suspend_,
314 // - paused_, ended_, 315 // - paused_, ended_,
315 // - pending_suspend_resume_cycle_. 316 // - pending_suspend_resume_cycle_.
316 void UpdatePlayState(); 317 void UpdatePlayState();
317 318
318 // Methods internal to UpdatePlayState(). 319 // Methods internal to UpdatePlayState().
319 PlayState UpdatePlayState_ComputePlayState(bool is_remote, 320 PlayState UpdatePlayState_ComputePlayState(bool is_remote,
321 bool is_suspended,
320 bool is_backgrounded); 322 bool is_backgrounded);
321 void SetDelegateState(DelegateState new_state); 323 void SetDelegateState(DelegateState new_state);
322 void SetMemoryReportingState(bool is_memory_reporting_enabled); 324 void SetMemoryReportingState(bool is_memory_reporting_enabled);
323 void SetSuspendState(bool is_suspended); 325 void SetSuspendState(bool is_suspended);
324 326
325 // Called at low frequency to tell external observers how much memory we're 327 // Called at low frequency to tell external observers how much memory we're
326 // using for video playback. Called by |memory_usage_reporting_timer_|. 328 // using for video playback. Called by |memory_usage_reporting_timer_|.
327 // Memory usage reporting is done in two steps, because |demuxer_| must be 329 // Memory usage reporting is done in two steps, because |demuxer_| must be
328 // accessed on the media thread. 330 // accessed on the media thread.
329 void ReportMemoryUsage(); 331 void ReportMemoryUsage();
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 // unimportant. 497 // unimportant.
496 bool suppress_destruction_errors_; 498 bool suppress_destruction_errors_;
497 499
498 // State indicating if it's okay to suspend or not. Updated on the first time 500 // State indicating if it's okay to suspend or not. Updated on the first time
499 // OnSuspendRequested() is called. If the state is UNKNOWN, the current frame 501 // OnSuspendRequested() is called. If the state is UNKNOWN, the current frame
500 // from the compositor will be queried to see if suspend is supported; the 502 // from the compositor will be queried to see if suspend is supported; the
501 // state will be set to YES or NO respectively if a frame is available. 503 // state will be set to YES or NO respectively if a frame is available.
502 enum class CanSuspendState { UNKNOWN, YES, NO }; 504 enum class CanSuspendState { UNKNOWN, YES, NO };
503 CanSuspendState can_suspend_state_; 505 CanSuspendState can_suspend_state_;
504 506
507 // Called some-time after OnHidden() if the media was suspended in a playing
508 // state as part of the call to OnHidden().
509 base::OneShotTimer background_pause_timer_;
510
505 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 511 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
506 }; 512 };
507 513
508 } // namespace media 514 } // namespace media
509 515
510 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 516 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | media/blink/webmediaplayer_impl.cc » ('j') | media/blink/webmediaplayer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698