Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 PipelineStatus status); | 189 PipelineStatus status); |
| 190 gfx::Size GetCanvasSize() const; | 190 gfx::Size GetCanvasSize() const; |
| 191 void SetDeviceScaleFactor(float scale_factor); | 191 void SetDeviceScaleFactor(float scale_factor); |
| 192 #endif | 192 #endif |
| 193 | 193 |
| 194 // Called from WebMediaPlayerCast. | 194 // Called from WebMediaPlayerCast. |
| 195 // TODO(hubbe): WMPI_CAST make private. | 195 // TODO(hubbe): WMPI_CAST make private. |
| 196 void OnPipelineSeeked(bool time_updated); | 196 void OnPipelineSeeked(bool time_updated); |
| 197 | 197 |
| 198 private: | 198 private: |
| 199 // Play states that are meaningful to |delegate_|. | |
| 200 // TODO(sandersd): This should move into WebMediaPlayerDelegate. | |
|
DaleCurtis
2016/03/25 23:21:23
Why not do it in this patch set then?
sandersd (OOO until July 31)
2016/03/25 23:42:42
The easy answer is that the Play state has additio
| |
| 201 enum class PlayState { | |
| 202 GONE, | |
| 203 PLAYING, | |
| 204 PAUSED, | |
| 205 ENDED, | |
| 206 }; | |
| 207 | |
| 199 void OnPipelineSuspended(); | 208 void OnPipelineSuspended(); |
| 200 void OnPipelineResumed(); | |
| 201 void OnPipelineEnded(); | 209 void OnPipelineEnded(); |
| 202 void OnPipelineError(PipelineStatus error); | 210 void OnPipelineError(PipelineStatus error); |
| 203 void OnPipelineMetadata(PipelineMetadata metadata); | 211 void OnPipelineMetadata(PipelineMetadata metadata); |
| 204 void OnPipelineBufferingStateChanged(BufferingState buffering_state); | 212 void OnPipelineBufferingStateChanged(BufferingState buffering_state); |
| 205 void OnDemuxerOpened(); | 213 void OnDemuxerOpened(); |
| 206 void OnAddTextTrack(const TextTrackConfig& config, | 214 void OnAddTextTrack(const TextTrackConfig& config, |
| 207 const AddTextTrackDoneCB& done_cb); | 215 const AddTextTrackDoneCB& done_cb); |
| 208 | 216 |
| 209 // Actually seek. Avoids causing |should_notify_time_changed_| to be set when | 217 // Actually seek. Avoids causing |should_notify_time_changed_| to be set when |
| 210 // |time_updated| is false. | 218 // |time_updated| is false. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 // is not available. | 275 // is not available. |
| 268 void OnWaitingForDecryptionKey(); | 276 void OnWaitingForDecryptionKey(); |
| 269 | 277 |
| 270 // Sets |cdm_context| on the pipeline and fires |cdm_attached_cb| when done. | 278 // Sets |cdm_context| on the pipeline and fires |cdm_attached_cb| when done. |
| 271 // Parameter order is reversed for easy binding. | 279 // Parameter order is reversed for easy binding. |
| 272 void SetCdm(const CdmAttachedCB& cdm_attached_cb, CdmContext* cdm_context); | 280 void SetCdm(const CdmAttachedCB& cdm_attached_cb, CdmContext* cdm_context); |
| 273 | 281 |
| 274 // Called when a CDM has been attached to the |pipeline_|. | 282 // Called when a CDM has been attached to the |pipeline_|. |
| 275 void OnCdmAttached(bool success); | 283 void OnCdmAttached(bool success); |
| 276 | 284 |
| 277 // Notifies |delegate_| that playback has started or was paused; also starts | 285 // Inspectes the current playback state and: |
| 278 // or stops the memory usage reporting timer respectively. | 286 // - notifies |delegate_|, |
| 279 void NotifyPlaybackStarted(); | 287 // - toggles the memory usage reporting timer, and |
| 280 void NotifyPlaybackPaused(); | 288 // - toggles suspend/resume as necessary. |
| 289 // This method should be called any time its dependent variables are changed. | |
| 290 void UpdatePlayState(); | |
| 291 | |
| 292 // Internal to UpdatePlayState() | |
| 293 // TODO(sandersd): Move this into |delegate_|. | |
| 294 void UpdatePlayState_SetPlayState(PlayState new_state); | |
| 281 | 295 |
| 282 // Called at low frequency to tell external observers how much memory we're | 296 // Called at low frequency to tell external observers how much memory we're |
| 283 // using for video playback. Called by |memory_usage_reporting_timer_|. | 297 // using for video playback. Called by |memory_usage_reporting_timer_|. |
| 284 // Memory usage reporting is done in two steps, because |demuxer_| must be | 298 // Memory usage reporting is done in two steps, because |demuxer_| must be |
| 285 // accessed on the media thread. | 299 // accessed on the media thread. |
| 286 void ReportMemoryUsage(); | 300 void ReportMemoryUsage(); |
| 287 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); | 301 void FinishMemoryUsageReport(int64_t demuxer_memory_usage); |
| 288 | 302 |
| 289 // Indicates if automatic resumption of a suspended playback is allowed. | 303 blink::WebLocalFrame* frame_; |
| 290 bool IsAutomaticResumeAllowed(); | |
| 291 | 304 |
| 292 blink::WebLocalFrame* frame_; | 305 // The play state last reported to |delegate_|. |
| 306 PlayState play_state_; | |
| 307 | |
| 308 // Set when OnSuspendRequested() is called with |must_suspend| unset. | |
| 309 bool idle_suspend_; | |
| 310 | |
| 311 // Set when OnSuspendRequested() is called with |must_suspend| set. | |
| 312 bool must_suspend_; | |
| 293 | 313 |
| 294 // TODO(hclam): get rid of these members and read from the pipeline directly. | 314 // TODO(hclam): get rid of these members and read from the pipeline directly. |
| 295 blink::WebMediaPlayer::NetworkState network_state_; | 315 blink::WebMediaPlayer::NetworkState network_state_; |
| 296 blink::WebMediaPlayer::ReadyState ready_state_; | 316 blink::WebMediaPlayer::ReadyState ready_state_; |
| 317 blink::WebMediaPlayer::ReadyState highest_ready_state_; | |
| 297 | 318 |
| 298 // Preload state for when |data_source_| is created after setPreload(). | 319 // Preload state for when |data_source_| is created after setPreload(). |
| 299 BufferedDataSource::Preload preload_; | 320 BufferedDataSource::Preload preload_; |
| 300 | 321 |
| 301 // Buffering strategy for when |data_source_| is created after | 322 // Buffering strategy for when |data_source_| is created after |
| 302 // setBufferingStrategy(). | 323 // setBufferingStrategy(). |
| 303 BufferedDataSource::BufferingStrategy buffering_strategy_; | 324 BufferedDataSource::BufferingStrategy buffering_strategy_; |
| 304 | 325 |
| 305 // Task runner for posting tasks on Chrome's main thread. Also used | 326 // Task runner for posting tasks on Chrome's main thread. Also used |
| 306 // for DCHECKs so methods calls won't execute in the wrong thread. | 327 // for DCHECKs so methods calls won't execute in the wrong thread. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 // started; prevents us from spuriously logging errors that are transient or | 460 // started; prevents us from spuriously logging errors that are transient or |
| 440 // unimportant. | 461 // unimportant. |
| 441 bool suppress_destruction_errors_; | 462 bool suppress_destruction_errors_; |
| 442 | 463 |
| 443 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 464 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 444 }; | 465 }; |
| 445 | 466 |
| 446 } // namespace media | 467 } // namespace media |
| 447 | 468 |
| 448 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 469 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |