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> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/optional.h" | 21 #include "base/optional.h" |
22 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
23 #include "base/time/default_tick_clock.h" | 23 #include "base/time/default_tick_clock.h" |
24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
25 #include "base/timer/elapsed_timer.h" | 25 #include "base/timer/elapsed_timer.h" |
26 #include "base/timer/timer.h" | 26 #include "base/timer/timer.h" |
27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
28 #include "media/base/media_observer.h" | 28 #include "media/base/media_observer.h" |
29 #include "media/base/media_tracks.h" | 29 #include "media/base/media_tracks.h" |
30 #include "media/base/pipeline_impl.h" | 30 #include "media/base/pipeline_impl.h" |
31 #include "media/base/renderer_factory.h" | 31 #include "media/base/renderer_factory_selector.h" |
32 #include "media/base/surface_manager.h" | 32 #include "media/base/surface_manager.h" |
33 #include "media/base/text_track.h" | 33 #include "media/base/text_track.h" |
34 #include "media/blink/buffered_data_source_host_impl.h" | 34 #include "media/blink/buffered_data_source_host_impl.h" |
35 #include "media/blink/media_blink_export.h" | 35 #include "media/blink/media_blink_export.h" |
36 #include "media/blink/multibuffer_data_source.h" | 36 #include "media/blink/multibuffer_data_source.h" |
37 #include "media/blink/video_frame_compositor.h" | 37 #include "media/blink/video_frame_compositor.h" |
38 #include "media/blink/webmediaplayer_delegate.h" | 38 #include "media/blink/webmediaplayer_delegate.h" |
39 #include "media/blink/webmediaplayer_params.h" | 39 #include "media/blink/webmediaplayer_params.h" |
40 #include "media/blink/webmediaplayer_util.h" | 40 #include "media/blink/webmediaplayer_util.h" |
41 #include "media/filters/pipeline_controller.h" | 41 #include "media/filters/pipeline_controller.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Pipeline. Handles normal resource loading, Media Source, and | 85 // Pipeline. Handles normal resource loading, Media Source, and |
86 // Encrypted Media. | 86 // Encrypted Media. |
87 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl | 87 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl |
88 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), | 88 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), |
89 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), | 89 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), |
90 public NON_EXPORTED_BASE(Pipeline::Client), | 90 public NON_EXPORTED_BASE(Pipeline::Client), |
91 public MediaObserverClient, | 91 public MediaObserverClient, |
92 public base::SupportsWeakPtr<WebMediaPlayerImpl> { | 92 public base::SupportsWeakPtr<WebMediaPlayerImpl> { |
93 public: | 93 public: |
94 // Constructs a WebMediaPlayer implementation using Chromium's media stack. | 94 // Constructs a WebMediaPlayer implementation using Chromium's media stack. |
95 // |delegate| and |renderer_factory| must not be null. | 95 // |delegate| and |renderer_factory_selector| must not be null. |
96 WebMediaPlayerImpl( | 96 WebMediaPlayerImpl( |
97 blink::WebLocalFrame* frame, | 97 blink::WebLocalFrame* frame, |
98 blink::WebMediaPlayerClient* client, | 98 blink::WebMediaPlayerClient* client, |
99 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, | 99 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
100 WebMediaPlayerDelegate* delegate, | 100 WebMediaPlayerDelegate* delegate, |
101 std::unique_ptr<RendererFactory> renderer_factory, | 101 std::unique_ptr<RendererFactorySelector> renderer_factory_selector, |
102 linked_ptr<UrlIndex> url_index, | 102 linked_ptr<UrlIndex> url_index, |
103 std::unique_ptr<WebMediaPlayerParams> params); | 103 std::unique_ptr<WebMediaPlayerParams> params); |
104 ~WebMediaPlayerImpl() override; | 104 ~WebMediaPlayerImpl() override; |
105 | 105 |
106 void Load(LoadType load_type, | 106 void Load(LoadType load_type, |
107 const blink::WebMediaPlayerSource& source, | 107 const blink::WebMediaPlayerSource& source, |
108 CORSMode cors_mode) override; | 108 CORSMode cors_mode) override; |
109 | 109 |
110 // Playback controls. | 110 // Playback controls. |
111 void Play() override; | 111 void Play() override; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 void NotifyDownloading(bool is_downloading); | 287 void NotifyDownloading(bool is_downloading); |
288 | 288 |
289 // Called by SurfaceManager when a surface is created. | 289 // Called by SurfaceManager when a surface is created. |
290 void OnSurfaceCreated(int surface_id); | 290 void OnSurfaceCreated(int surface_id); |
291 | 291 |
292 // Called by GpuVideoDecoder on Android to request a surface to render to (if | 292 // Called by GpuVideoDecoder on Android to request a surface to render to (if |
293 // necessary). | 293 // necessary). |
294 void OnSurfaceRequested(bool decoder_requires_restart_for_overlay, | 294 void OnSurfaceRequested(bool decoder_requires_restart_for_overlay, |
295 const SurfaceCreatedCB& surface_created_cb); | 295 const SurfaceCreatedCB& surface_created_cb); |
296 | 296 |
297 // Creates a Renderer via the |renderer_factory_|. | 297 // Creates a Renderer via the |renderer_factory_selector_|. |
298 std::unique_ptr<Renderer> CreateRenderer(); | 298 std::unique_ptr<Renderer> CreateRenderer(); |
299 | 299 |
300 // Finishes starting the pipeline due to a call to load(). | 300 // Finishes starting the pipeline due to a call to load(). |
301 void StartPipeline(); | 301 void StartPipeline(); |
302 | 302 |
303 // Restart the player/pipeline as soon as possible. This will destroy the | 303 // Restart the player/pipeline as soon as possible. This will destroy the |
304 // current renderer, if any, and create a new one via the RendererFactory; and | 304 // current renderer, if any, and create a new one via the RendererFactory; and |
305 // then seek to resume playback at the current position. | 305 // then seek to resume playback at the current position. |
306 void ScheduleRestart(); | 306 void ScheduleRestart(); |
307 | 307 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 WebMediaPlayerCast cast_impl_; | 610 WebMediaPlayerCast cast_impl_; |
611 #endif | 611 #endif |
612 | 612 |
613 // The last volume received by setVolume() and the last volume multiplier from | 613 // The last volume received by setVolume() and the last volume multiplier from |
614 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less | 614 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less |
615 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) | 615 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) |
616 // for a transient sound. Playout volume is derived by volume * multiplier. | 616 // for a transient sound. Playout volume is derived by volume * multiplier. |
617 double volume_; | 617 double volume_; |
618 double volume_multiplier_; | 618 double volume_multiplier_; |
619 | 619 |
620 std::unique_ptr<RendererFactory> renderer_factory_; | 620 std::unique_ptr<RendererFactorySelector> renderer_factory_selector_; |
621 | 621 |
622 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen. | 622 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen. |
623 // This will be null everywhere but Android. | 623 // This will be null everywhere but Android. |
624 SurfaceManager* surface_manager_; | 624 SurfaceManager* surface_manager_; |
625 | 625 |
626 // For canceling ongoing surface creation requests when exiting fullscreen. | 626 // For canceling ongoing surface creation requests when exiting fullscreen. |
627 base::CancelableCallback<void(int)> surface_created_cb_; | 627 base::CancelableCallback<void(int)> surface_created_cb_; |
628 | 628 |
629 // The current overlay surface id. Populated while in fullscreen once the | 629 // The current overlay surface id. Populated while in fullscreen once the |
630 // surface is created. | 630 // surface is created. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 base::CancelableCallback<void(base::TimeTicks)> frame_time_report_cb_; | 724 base::CancelableCallback<void(base::TimeTicks)> frame_time_report_cb_; |
725 | 725 |
726 bool initial_video_height_recorded_ = false; | 726 bool initial_video_height_recorded_ = false; |
727 | 727 |
728 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 728 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
729 }; | 729 }; |
730 | 730 |
731 } // namespace media | 731 } // namespace media |
732 | 732 |
733 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 733 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |