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

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

Issue 2611333003: [Video] Disable bg optimization if avg keyframe distance is >10s (Closed)
Patch Set: 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
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/cancelable_callback.h" 14 #include "base/cancelable_callback.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
21 #include "base/time/default_tick_clock.h" 21 #include "base/time/default_tick_clock.h"
22 #include "base/time/time.h"
22 #include "base/timer/elapsed_timer.h" 23 #include "base/timer/elapsed_timer.h"
23 #include "base/timer/timer.h" 24 #include "base/timer/timer.h"
24 #include "build/build_config.h" 25 #include "build/build_config.h"
25 #include "media/base/media_observer.h" 26 #include "media/base/media_observer.h"
26 #include "media/base/media_tracks.h" 27 #include "media/base/media_tracks.h"
27 #include "media/base/pipeline_impl.h" 28 #include "media/base/pipeline_impl.h"
28 #include "media/base/renderer_factory.h" 29 #include "media/base/renderer_factory.h"
29 #include "media/base/surface_manager.h" 30 #include "media/base/surface_manager.h"
30 #include "media/base/text_track.h" 31 #include "media/base/text_track.h"
31 #include "media/blink/buffered_data_source_host_impl.h" 32 #include "media/blink/buffered_data_source_host_impl.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // Returns true if the player is hidden. 365 // Returns true if the player is hidden.
365 bool IsHidden() const; 366 bool IsHidden() const;
366 367
367 // Return whether |pipeline_metadata_| is compatible with an overlay. This 368 // Return whether |pipeline_metadata_| is compatible with an overlay. This
368 // is intended for android. 369 // is intended for android.
369 bool DoesOverlaySupportMetadata() const; 370 bool DoesOverlaySupportMetadata() const;
370 371
371 // Whether the media should be paused when hidden. 372 // Whether the media should be paused when hidden.
372 bool ShouldPauseWhenHidden() const; 373 bool ShouldPauseWhenHidden() const;
373 374
375 // Whether the video should recover fast when shown if decoding was disabled
376 // in the background.
377 bool ShouldDecodeFastWhenShown() const;
378
374 blink::WebLocalFrame* frame_; 379 blink::WebLocalFrame* frame_;
375 380
376 // The playback state last reported to |delegate_|, to avoid setting duplicate 381 // The playback state last reported to |delegate_|, to avoid setting duplicate
377 // states. (Which can have undesired effects like resetting the idle timer.) 382 // states. (Which can have undesired effects like resetting the idle timer.)
378 DelegateState delegate_state_; 383 DelegateState delegate_state_;
379 384
380 // Set when OnSuspendRequested() is called with |must_suspend| unset. 385 // Set when OnSuspendRequested() is called with |must_suspend| unset.
381 bool is_idle_; 386 bool is_idle_;
382 387
383 // Set when OnSuspendRequested() is called with |must_suspend| set. 388 // Set when OnSuspendRequested() is called with |must_suspend| set.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 base::TimeTicks last_time_loading_progressed_; 597 base::TimeTicks last_time_loading_progressed_;
593 598
594 std::unique_ptr<base::TickClock> tick_clock_; 599 std::unique_ptr<base::TickClock> tick_clock_;
595 600
596 // Monitors the player events. 601 // Monitors the player events.
597 base::WeakPtr<MediaObserver> observer_; 602 base::WeakPtr<MediaObserver> observer_;
598 603
599 // Whether the player is currently in autoplay muted state. 604 // Whether the player is currently in autoplay muted state.
600 bool autoplay_muted_ = false; 605 bool autoplay_muted_ = false;
601 606
607 // The maximum video keyframe distance that allows triggering background
608 // playback optimizations.
609 // 10 seconds by default but can be overridden by a Finch experiment.
610 base::TimeDelta max_keyframe_distance_for_fast_decode_ =
611 base::TimeDelta::FromSeconds(10);
612
602 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 613 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
603 }; 614 };
604 615
605 } // namespace media 616 } // namespace media
606 617
607 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 618 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698