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

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

Issue 1766783003: Expand suspension of idle media players to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notify_pause
Patch Set: Cleanup. Created 4 years, 9 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 <string> 10 #include <string>
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 blink::WebAudioSourceProvider* audioSourceProvider() override; 160 blink::WebAudioSourceProvider* audioSourceProvider() override;
161 161
162 void setContentDecryptionModule( 162 void setContentDecryptionModule(
163 blink::WebContentDecryptionModule* cdm, 163 blink::WebContentDecryptionModule* cdm,
164 blink::WebContentDecryptionModuleResult result) override; 164 blink::WebContentDecryptionModuleResult result) override;
165 165
166 void enteredFullscreen() override; 166 void enteredFullscreen() override;
167 void exitedFullscreen() override; 167 void exitedFullscreen() override;
168 168
169 // WebMediaPlayerDelegate::Observer implementation. 169 // WebMediaPlayerDelegate::Observer implementation.
170 void OnHidden(bool must_suspend) override; 170 void OnHidden() override;
171 void OnShown() override; 171 void OnShown() override;
172 void OnSuspend(bool must_suspend) override;
sandersd (OOO until July 31) 2016/03/07 23:27:51 I keep getting tripped up on this bool, so +1 for
DaleCurtis 2016/03/09 02:56:14 I kept going around on this and can't find names I
172 void OnPlay() override; 173 void OnPlay() override;
173 void OnPause() override; 174 void OnPause() override;
174 void OnVolumeMultiplierUpdate(double multiplier) override; 175 void OnVolumeMultiplierUpdate(double multiplier) override;
175 176
176 #if defined(OS_ANDROID) // WMPI_CAST 177 #if defined(OS_ANDROID) // WMPI_CAST
177 bool isRemote() const override; 178 bool isRemote() const override;
178 void requestRemotePlayback() override; 179 void requestRemotePlayback() override;
179 void requestRemotePlaybackControl() override; 180 void requestRemotePlaybackControl() override;
180 181
181 void SetMediaPlayerManager( 182 void SetMediaPlayerManager(
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 void NotifyPlaybackStarted(); 273 void NotifyPlaybackStarted();
273 void NotifyPlaybackPaused(); 274 void NotifyPlaybackPaused();
274 275
275 // Called at low frequency to tell external observers how much memory we're 276 // Called at low frequency to tell external observers how much memory we're
276 // using for video playback. Called by |memory_usage_reporting_timer_|. 277 // using for video playback. Called by |memory_usage_reporting_timer_|.
277 // Memory usage reporting is done in two steps, because |demuxer_| must be 278 // Memory usage reporting is done in two steps, because |demuxer_| must be
278 // accessed on the media thread. 279 // accessed on the media thread.
279 void ReportMemoryUsage(); 280 void ReportMemoryUsage();
280 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); 281 void FinishMemoryUsageReport(int64_t demuxer_memory_usage);
281 282
283 // Indicates if Resume() or Suspend() are allowed to be called respectively.
sandersd (OOO until July 31) 2016/03/07 23:27:51 I'm not clear on this comment given that there is
DaleCurtis 2016/03/09 02:56:14 Done.
284 bool IsResumeAllowed();
285
282 blink::WebLocalFrame* frame_; 286 blink::WebLocalFrame* frame_;
283 287
284 // TODO(hclam): get rid of these members and read from the pipeline directly. 288 // TODO(hclam): get rid of these members and read from the pipeline directly.
285 blink::WebMediaPlayer::NetworkState network_state_; 289 blink::WebMediaPlayer::NetworkState network_state_;
286 blink::WebMediaPlayer::ReadyState ready_state_; 290 blink::WebMediaPlayer::ReadyState ready_state_;
287 291
288 // Preload state for when |data_source_| is created after setPreload(). 292 // Preload state for when |data_source_| is created after setPreload().
289 BufferedDataSource::Preload preload_; 293 BufferedDataSource::Preload preload_;
290 294
291 // Buffering strategy for when |data_source_| is created after 295 // Buffering strategy for when |data_source_| is created after
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 418
415 // The last volume received by setVolume() and the last volume multiplier from 419 // The last volume received by setVolume() and the last volume multiplier from
416 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less 420 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less
417 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) 421 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking)
418 // for a transient sound. Playout volume is derived by volume * multiplier. 422 // for a transient sound. Playout volume is derived by volume * multiplier.
419 double volume_; 423 double volume_;
420 double volume_multiplier_; 424 double volume_multiplier_;
421 425
422 scoped_ptr<RendererFactory> renderer_factory_; 426 scoped_ptr<RendererFactory> renderer_factory_;
423 427
428 // Indicates if playback may be started from the background via a to play from
mlamouri (slow - plz ping) 2016/03/05 22:37:36 nit: "via a to play from JavaScript" might be miss
429 // JavaScript or the media session.
430 enum class BackgroundPlaybackState {
431 PLAY_FORBIDDEN_NEVER_CALLED_IN_FOREGROUND,
xhwang 2016/03/07 19:13:58 Can you provide more comments around these states?
DaleCurtis 2016/03/07 19:23:07 Yeah my names are bad :( I was trying to capture "
DaleCurtis 2016/03/09 02:56:14 After some more thought, I don't need these values
432 PLAY_FORBIDDEN_WHEN_SUSPENDED,
433 PLAY_ALLOWED_WHEN_SUSPENDED,
434 };
435 BackgroundPlaybackState background_playback_state_;
436
424 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen. 437 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen.
425 // This will be null everywhere but Android. 438 // This will be null everywhere but Android.
426 SurfaceManager* surface_manager_; 439 SurfaceManager* surface_manager_;
427 440
428 // Suppresses calls to OnPipelineError() after destruction / shutdown has been 441 // Suppresses calls to OnPipelineError() after destruction / shutdown has been
429 // started; prevents us from spuriously logging errors that are transient or 442 // started; prevents us from spuriously logging errors that are transient or
430 // unimportant. 443 // unimportant.
431 bool suppress_destruction_errors_; 444 bool suppress_destruction_errors_;
432 445
433 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 446 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
434 }; 447 };
435 448
436 } // namespace media 449 } // namespace media
437 450
438 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 451 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698