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

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

Issue 2644723004: [Video] Don't pause video-only elements if they're already paused... (Closed)
Patch Set: Improved comments, extracted method Created 3 years, 11 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>
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 372
373 // Returns true if the player's source is streaming. 373 // Returns true if the player's source is streaming.
374 bool IsStreaming() const; 374 bool IsStreaming() const;
375 375
376 // Return whether |pipeline_metadata_| is compatible with an overlay. This 376 // Return whether |pipeline_metadata_| is compatible with an overlay. This
377 // is intended for android. 377 // is intended for android.
378 bool DoesOverlaySupportMetadata() const; 378 bool DoesOverlaySupportMetadata() const;
379 379
380 // Whether the video should be paused when hidden. Uses metadata so has 380 // Whether the video should be paused when hidden. Uses metadata so has
381 // meaning only after the pipeline has started, otherwise returns false. 381 // meaning only after the pipeline has started, otherwise returns false.
382 // Doesn't check if the video can actually be paused depending on the
383 // pipeline's state.
382 bool ShouldPauseVideoWhenHidden() const; 384 bool ShouldPauseVideoWhenHidden() const;
383 385
384 // Whether the video track should be disabled when hidden. Uses metadata so 386 // Whether the video track should be disabled when hidden. Uses metadata so
385 // has meaning only after the pipeline has started, otherwise returns false. 387 // has meaning only after the pipeline has started, otherwise returns false.
388 // Doesn't check if the video track can actually be disabled depending on the
389 // pipeline's state.
386 bool ShouldDisableVideoWhenHidden() const; 390 bool ShouldDisableVideoWhenHidden() const;
387 391
388 // Whether the video is suitable for background playback optimizations (either 392 // Whether the video is suitable for background playback optimizations (either
389 // pausing it or disabling the video track). Uses metadata so has meaning only 393 // pausing it or disabling the video track). Uses metadata so has meaning only
390 // after the pipeline has started, otherwise returns false. 394 // after the pipeline has started, otherwise returns false.
395 // The logical OR between the two methods above that is also used as their
396 // common implementation.
391 bool IsBackgroundOptimizationCandidate() const; 397 bool IsBackgroundOptimizationCandidate() const;
392 398
399 // If enabling or disabling background video optimization has been delayed,
400 // because of the pipeline not running, seeking or resuming, this method
401 // needs to be called to update the optimization state.
402 void UpdateBackgroundVideoOptimizationState();
403
404 // Pauses a hidden video only player to save power if possible.
405 // Must be called when either of the following happens:
406 // - right after the video was hidden,
407 // - right ater the pipeline has resumed if the video is hidden.
408 void PauseVideoIfNeeded();
409
393 // Disables the video track to save power if possible. 410 // Disables the video track to save power if possible.
394 // Must be called when either of the following happens: 411 // Must be called when either of the following happens:
395 // - right after the video was hidden, 412 // - right after the video was hidden,
396 // - right after the pipeline has started (|seeking_| is used to detect the 413 // - right after the pipeline has started (|seeking_| is used to detect the
397 // when pipeline started) if the video is hidden, 414 // when pipeline started) if the video is hidden,
398 // - right ater the pipeline has resumed if the video is hidden. 415 // - right ater the pipeline has resumed if the video is hidden.
399 void DisableVideoTrackIfNeeded(); 416 void DisableVideoTrackIfNeeded();
400 417
401 // Enables the video track if it was disabled before to save power. 418 // Enables the video track if it was disabled before to save power.
402 // Must be called when either of the following happens: 419 // Must be called when either of the following happens:
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 680
664 // Pipeline media duration overridden by tests. 681 // Pipeline media duration overridden by tests.
665 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_; 682 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_;
666 683
667 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 684 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
668 }; 685 };
669 686
670 } // namespace media 687 } // namespace media
671 688
672 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 689 #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