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

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

Issue 2618883002: [Media, Video] Enable the video track for a new renderer. (Closed)
Patch Set: Added OnBeforeResume callback 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 bool is_suspended; 244 bool is_suspended;
245 }; 245 };
246 246
247 private: 247 private:
248 friend class WebMediaPlayerImplTest; 248 friend class WebMediaPlayerImplTest;
249 249
250 void EnableOverlay(); 250 void EnableOverlay();
251 void DisableOverlay(); 251 void DisableOverlay();
252 252
253 void OnPipelineSuspended(); 253 void OnPipelineSuspended();
254 void OnBeforePipelineResume();
255 void OnPipelineResumed();
254 void OnDemuxerOpened(); 256 void OnDemuxerOpened();
255 257
256 // Pipeline::Client overrides. 258 // Pipeline::Client overrides.
257 void OnError(PipelineStatus status) override; 259 void OnError(PipelineStatus status) override;
258 void OnEnded() override; 260 void OnEnded() override;
259 void OnMetadata(PipelineMetadata metadata) override; 261 void OnMetadata(PipelineMetadata metadata) override;
260 void OnBufferingStateChange(BufferingState state) override; 262 void OnBufferingStateChange(BufferingState state) override;
261 void OnDurationChange() override; 263 void OnDurationChange() override;
262 void OnAddTextTrack(const TextTrackConfig& config, 264 void OnAddTextTrack(const TextTrackConfig& config,
263 const AddTextTrackDoneCB& done_cb) override; 265 const AddTextTrackDoneCB& done_cb) override;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // Returns true if the player's source is streaming. 369 // Returns true if the player's source is streaming.
368 bool IsStreaming() const; 370 bool IsStreaming() const;
369 371
370 // Return whether |pipeline_metadata_| is compatible with an overlay. This 372 // Return whether |pipeline_metadata_| is compatible with an overlay. This
371 // is intended for android. 373 // is intended for android.
372 bool DoesOverlaySupportMetadata() const; 374 bool DoesOverlaySupportMetadata() const;
373 375
374 // Whether the media should be paused when hidden. 376 // Whether the media should be paused when hidden.
375 bool ShouldPauseWhenHidden() const; 377 bool ShouldPauseWhenHidden() const;
376 378
379 // Whether the video track should be disabled when hidden.
380 bool ShouldDisableVideoWhenHidden() const;
381
382 // Disables the video track to save power if possible.
383 // Must be called when the video was hidden and also when pipeline seeked or
384 // resumed if the video is hidden.
385 void DisableVideoTrackIfNeeded();
386
387 // Enables the video track if it was disabled before to save power,
388 // if possible.
389 // Must be called when the video was shown and also when pipeline seeked or
390 // resumed if the video is shown.
391 // Must also be called when the pipeline is about to resume, see
392 // https://crbug.com/678374.
sandersd (OOO until July 31) 2017/01/10 21:34:37 Somewhat confusing, in particular because resume i
whywhat 2017/01/11 19:41:30 Rephrased the comments, hopefully they are less co
393 void EnableVideoTrackIfNeeded();
394
377 blink::WebLocalFrame* frame_; 395 blink::WebLocalFrame* frame_;
378 396
379 // The playback state last reported to |delegate_|, to avoid setting duplicate 397 // The playback state last reported to |delegate_|, to avoid setting duplicate
380 // states. (Which can have undesired effects like resetting the idle timer.) 398 // states. (Which can have undesired effects like resetting the idle timer.)
381 DelegateState delegate_state_; 399 DelegateState delegate_state_;
382 400
383 // Set when OnSuspendRequested() is called with |must_suspend| unset. 401 // Set when OnSuspendRequested() is called with |must_suspend| unset.
384 bool is_idle_; 402 bool is_idle_;
385 403
386 // Set when OnSuspendRequested() is called with |must_suspend| set. 404 // Set when OnSuspendRequested() is called with |must_suspend| set.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 base::TimeTicks last_time_loading_progressed_; 613 base::TimeTicks last_time_loading_progressed_;
596 614
597 std::unique_ptr<base::TickClock> tick_clock_; 615 std::unique_ptr<base::TickClock> tick_clock_;
598 616
599 // Monitors the player events. 617 // Monitors the player events.
600 base::WeakPtr<MediaObserver> observer_; 618 base::WeakPtr<MediaObserver> observer_;
601 619
602 // Whether the player is currently in autoplay muted state. 620 // Whether the player is currently in autoplay muted state.
603 bool autoplay_muted_ = false; 621 bool autoplay_muted_ = false;
604 622
623 // Whether disabled the video track as an optimization.
624 bool video_track_disabled_ = false;
625
626 // Whether the pipeline is being resumed at the moment.
627 bool is_pipeline_resuming_ = false;
628
605 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 629 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
606 }; 630 };
607 631
608 } // namespace media 632 } // namespace media
609 633
610 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 634 #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