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 <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/timer/elapsed_timer.h" | 21 #include "base/timer/elapsed_timer.h" |
22 #include "base/timer/timer.h" | 22 #include "base/timer/timer.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "media/base/media_observer.h" |
24 #include "media/base/media_tracks.h" | 25 #include "media/base/media_tracks.h" |
25 #include "media/base/pipeline_impl.h" | 26 #include "media/base/pipeline_impl.h" |
26 #include "media/base/renderer_factory.h" | 27 #include "media/base/renderer_factory.h" |
27 #include "media/base/surface_manager.h" | 28 #include "media/base/surface_manager.h" |
28 #include "media/base/text_track.h" | 29 #include "media/base/text_track.h" |
29 #include "media/blink/buffered_data_source_host_impl.h" | 30 #include "media/blink/buffered_data_source_host_impl.h" |
30 #include "media/blink/media_blink_export.h" | 31 #include "media/blink/media_blink_export.h" |
31 #include "media/blink/multibuffer_data_source.h" | 32 #include "media/blink/multibuffer_data_source.h" |
32 #include "media/blink/video_frame_compositor.h" | 33 #include "media/blink/video_frame_compositor.h" |
33 #include "media/blink/webmediaplayer_delegate.h" | 34 #include "media/blink/webmediaplayer_delegate.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 PipelineStatus status); | 205 PipelineStatus status); |
205 gfx::Size GetCanvasSize() const; | 206 gfx::Size GetCanvasSize() const; |
206 void SetDeviceScaleFactor(float scale_factor); | 207 void SetDeviceScaleFactor(float scale_factor); |
207 void setPoster(const blink::WebURL& poster) override; | 208 void setPoster(const blink::WebURL& poster) override; |
208 #endif | 209 #endif |
209 | 210 |
210 // Called from WebMediaPlayerCast. | 211 // Called from WebMediaPlayerCast. |
211 // TODO(hubbe): WMPI_CAST make private. | 212 // TODO(hubbe): WMPI_CAST make private. |
212 void OnPipelineSeeked(bool time_updated); | 213 void OnPipelineSeeked(bool time_updated); |
213 | 214 |
| 215 // Restart the player/pipeline as soon as possible. This will destroy the |
| 216 // current renderer, if any, and create a new one via the RendererFactory; and |
| 217 // then seek to resume playback at the current position. |
| 218 void ScheduleRestart(); |
| 219 |
214 // Distinct states that |delegate_| can be in. | 220 // Distinct states that |delegate_| can be in. |
215 // TODO(sandersd): This should move into WebMediaPlayerDelegate. | 221 // TODO(sandersd): This should move into WebMediaPlayerDelegate. |
216 // (Public for testing.) | 222 // (Public for testing.) |
217 enum class DelegateState { | 223 enum class DelegateState { |
218 GONE, | 224 GONE, |
219 PLAYING, | 225 PLAYING, |
220 PAUSED, | 226 PAUSED, |
221 ENDED, | 227 ENDED, |
222 }; | 228 }; |
223 | 229 |
(...skipping 23 matching lines...) Expand all Loading... |
247 void OnAddTextTrack(const TextTrackConfig& config, | 253 void OnAddTextTrack(const TextTrackConfig& config, |
248 const AddTextTrackDoneCB& done_cb) override; | 254 const AddTextTrackDoneCB& done_cb) override; |
249 void OnWaitingForDecryptionKey() override; | 255 void OnWaitingForDecryptionKey() override; |
250 void OnVideoNaturalSizeChange(const gfx::Size& size) override; | 256 void OnVideoNaturalSizeChange(const gfx::Size& size) override; |
251 void OnVideoOpacityChange(bool opaque) override; | 257 void OnVideoOpacityChange(bool opaque) override; |
252 | 258 |
253 // Actually seek. Avoids causing |should_notify_time_changed_| to be set when | 259 // Actually seek. Avoids causing |should_notify_time_changed_| to be set when |
254 // |time_updated| is false. | 260 // |time_updated| is false. |
255 void DoSeek(base::TimeDelta time, bool time_updated); | 261 void DoSeek(base::TimeDelta time, bool time_updated); |
256 | 262 |
257 // Ask for the renderer to be restarted (destructed and recreated). | |
258 void ScheduleRestart(); | |
259 | |
260 // Called after |defer_load_cb_| has decided to allow the load. If | 263 // Called after |defer_load_cb_| has decided to allow the load. If |
261 // |defer_load_cb_| is null this is called immediately. | 264 // |defer_load_cb_| is null this is called immediately. |
262 void DoLoad(LoadType load_type, | 265 void DoLoad(LoadType load_type, |
263 const blink::WebURL& url, | 266 const blink::WebURL& url, |
264 CORSMode cors_mode); | 267 CORSMode cors_mode); |
265 | 268 |
266 // Called after asynchronous initialization of a data source completed. | 269 // Called after asynchronous initialization of a data source completed. |
267 void DataSourceInitialized(bool success); | 270 void DataSourceInitialized(bool success); |
268 | 271 |
269 // Called when the data source is downloading or paused. | 272 // Called when the data source is downloading or paused. |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 base::OneShotTimer background_pause_timer_; | 550 base::OneShotTimer background_pause_timer_; |
548 | 551 |
549 // Monitors the watch time of the played content. | 552 // Monitors the watch time of the played content. |
550 std::unique_ptr<WatchTimeReporter> watch_time_reporter_; | 553 std::unique_ptr<WatchTimeReporter> watch_time_reporter_; |
551 bool is_encrypted_; | 554 bool is_encrypted_; |
552 | 555 |
553 // Number of times we've reached BUFFERING_HAVE_NOTHING during playback. | 556 // Number of times we've reached BUFFERING_HAVE_NOTHING during playback. |
554 int underflow_count_; | 557 int underflow_count_; |
555 std::unique_ptr<base::ElapsedTimer> underflow_timer_; | 558 std::unique_ptr<base::ElapsedTimer> underflow_timer_; |
556 | 559 |
| 560 // Monitors the player events. |
| 561 base::WeakPtr<MediaObserver> observer_; |
| 562 |
557 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 563 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
558 }; | 564 }; |
559 | 565 |
560 } // namespace media | 566 } // namespace media |
561 | 567 |
562 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 568 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |