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

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

Issue 2618883002: [Media, Video] Enable the video track for a new renderer. (Closed)
Patch Set: Fixed debug tests 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') | 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>
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 bool is_suspended; 242 bool is_suspended;
243 }; 243 };
244 244
245 private: 245 private:
246 friend class WebMediaPlayerImplTest; 246 friend class WebMediaPlayerImplTest;
247 247
248 void EnableOverlay(); 248 void EnableOverlay();
249 void DisableOverlay(); 249 void DisableOverlay();
250 250
251 void OnPipelineSuspended(); 251 void OnPipelineSuspended();
252 void OnBeforePipelineResume();
253 void OnPipelineResumed();
252 void OnDemuxerOpened(); 254 void OnDemuxerOpened();
253 255
254 // Pipeline::Client overrides. 256 // Pipeline::Client overrides.
255 void OnError(PipelineStatus status) override; 257 void OnError(PipelineStatus status) override;
256 void OnEnded() override; 258 void OnEnded() override;
257 void OnMetadata(PipelineMetadata metadata) override; 259 void OnMetadata(PipelineMetadata metadata) override;
258 void OnBufferingStateChange(BufferingState state) override; 260 void OnBufferingStateChange(BufferingState state) override;
259 void OnDurationChange() override; 261 void OnDurationChange() override;
260 void OnAddTextTrack(const TextTrackConfig& config, 262 void OnAddTextTrack(const TextTrackConfig& config,
261 const AddTextTrackDoneCB& done_cb) override; 263 const AddTextTrackDoneCB& done_cb) override;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // Returns true if the player is hidden. 364 // Returns true if the player is hidden.
363 bool IsHidden() const; 365 bool IsHidden() const;
364 366
365 // Returns true if the player's source is streaming. 367 // Returns true if the player's source is streaming.
366 bool IsStreaming() const; 368 bool IsStreaming() const;
367 369
368 // Return whether |pipeline_metadata_| is compatible with an overlay. This 370 // Return whether |pipeline_metadata_| is compatible with an overlay. This
369 // is intended for android. 371 // is intended for android.
370 bool DoesOverlaySupportMetadata() const; 372 bool DoesOverlaySupportMetadata() const;
371 373
372 // Whether the media should be paused when hidden. 374 // Whether the media should be paused when hidden. Uses metadata so has
375 // meaning only after the pipeline has started, otherwise returns false.
373 bool ShouldPauseWhenHidden() const; 376 bool ShouldPauseWhenHidden() const;
374 377
378 // Whether the video track should be disabled when hidden. Uses metadata so
379 // has meaning only after the pipeline has started, otherwise returns false.
380 bool ShouldDisableVideoWhenHidden() const;
381
382 // Disables the video track to save power if possible.
383 // Must be called when either of the following happens:
384 // - right after the video was hidden,
385 // - right after the pipeline has started (|seeking_| is used to detect the
386 // when pipeline started) if the video is hidden,
387 // - right ater the pipeline has resumed if the video is hidden.
388 void DisableVideoTrackIfNeeded();
389
390 // Enables the video track if it was disabled before to save power.
391 // Must be called when either of the following happens:
392 // - right after the video was shown,
393 // - right before the pipeline is requested to resume
394 // (see https://crbug.com/678374),
395 // - right after the pipeline has resumed if the video is not hidden.
396 void EnableVideoTrackIfNeeded();
397
375 blink::WebLocalFrame* frame_; 398 blink::WebLocalFrame* frame_;
376 399
377 // The playback state last reported to |delegate_|, to avoid setting duplicate 400 // The playback state last reported to |delegate_|, to avoid setting duplicate
378 // states. (Which can have undesired effects like resetting the idle timer.) 401 // states. (Which can have undesired effects like resetting the idle timer.)
379 DelegateState delegate_state_; 402 DelegateState delegate_state_;
380 403
381 // Set when OnSuspendRequested() is called with |must_suspend| unset. 404 // Set when OnSuspendRequested() is called with |must_suspend| unset.
382 bool is_idle_; 405 bool is_idle_;
383 406
384 // Set when OnSuspendRequested() is called with |must_suspend| set. 407 // Set when OnSuspendRequested() is called with |must_suspend| set.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 base::TimeTicks last_time_loading_progressed_; 616 base::TimeTicks last_time_loading_progressed_;
594 617
595 std::unique_ptr<base::TickClock> tick_clock_; 618 std::unique_ptr<base::TickClock> tick_clock_;
596 619
597 // Monitors the player events. 620 // Monitors the player events.
598 base::WeakPtr<MediaObserver> observer_; 621 base::WeakPtr<MediaObserver> observer_;
599 622
600 // Whether the player is currently in autoplay muted state. 623 // Whether the player is currently in autoplay muted state.
601 bool autoplay_muted_ = false; 624 bool autoplay_muted_ = false;
602 625
626 // Whether disabled the video track as an optimization.
627 bool video_track_disabled_ = false;
628
629 // Whether the pipeline is being resumed at the moment.
630 bool is_pipeline_resuming_ = false;
631
603 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 632 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
604 }; 633 };
605 634
606 } // namespace media 635 } // namespace media
607 636
608 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 637 #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