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

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: Remove now incorrect test. 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') | 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>
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();
330 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); 332 void FinishMemoryUsageReport(int64_t demuxer_memory_usage);
331 333
334 // Called during OnHidden() when we want a suspended player to enter the
335 // paused state after some idle timeout.
336 void ScheduleIdlePauseTimer();
337
332 blink::WebLocalFrame* frame_; 338 blink::WebLocalFrame* frame_;
333 339
334 // The playback state last reported to |delegate_|, to avoid setting duplicate 340 // The playback state last reported to |delegate_|, to avoid setting duplicate
335 // states. (Which can have undesired effects like resetting the idle timer.) 341 // states. (Which can have undesired effects like resetting the idle timer.)
336 DelegateState delegate_state_; 342 DelegateState delegate_state_;
337 343
338 // Set when OnSuspendRequested() is called with |must_suspend| unset. 344 // Set when OnSuspendRequested() is called with |must_suspend| unset.
339 bool is_idle_; 345 bool is_idle_;
340 346
341 // Set when OnSuspendRequested() is called with |must_suspend| set. 347 // Set when OnSuspendRequested() is called with |must_suspend| set.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 // unimportant. 501 // unimportant.
496 bool suppress_destruction_errors_; 502 bool suppress_destruction_errors_;
497 503
498 // State indicating if it's okay to suspend or not. Updated on the first time 504 // 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 505 // 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 506 // 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. 507 // state will be set to YES or NO respectively if a frame is available.
502 enum class CanSuspendState { UNKNOWN, YES, NO }; 508 enum class CanSuspendState { UNKNOWN, YES, NO };
503 CanSuspendState can_suspend_state_; 509 CanSuspendState can_suspend_state_;
504 510
511 // Called some-time after OnHidden() if the media was suspended in a playing
512 // state as part of the call to OnHidden().
513 base::OneShotTimer background_pause_timer_;
514
505 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 515 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
506 }; 516 };
507 517
508 } // namespace media 518 } // namespace media
509 519
510 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 520 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698