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 <memory> | 10 #include <memory> |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 #include "media/blink/multibuffer_data_source.h" | 37 #include "media/blink/multibuffer_data_source.h" |
| 38 #include "media/blink/video_frame_compositor.h" | 38 #include "media/blink/video_frame_compositor.h" |
| 39 #include "media/blink/webmediaplayer_delegate.h" | 39 #include "media/blink/webmediaplayer_delegate.h" |
| 40 #include "media/blink/webmediaplayer_params.h" | 40 #include "media/blink/webmediaplayer_params.h" |
| 41 #include "media/blink/webmediaplayer_util.h" | 41 #include "media/blink/webmediaplayer_util.h" |
| 42 #include "media/filters/pipeline_controller.h" | 42 #include "media/filters/pipeline_controller.h" |
| 43 #include "media/renderers/skcanvas_video_renderer.h" | 43 #include "media/renderers/skcanvas_video_renderer.h" |
| 44 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" | 44 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" |
| 45 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 45 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
| 46 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 46 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 47 #include "third_party/WebKit/public/platform/WebSurfaceLayerBridgeObserver.h" | |
| 48 #include "third_party/WebKit/public/platform/WebVideoSurfaceLayerBridge.h" | |
| 47 #include "url/gurl.h" | 49 #include "url/gurl.h" |
| 48 | 50 |
| 49 #if defined(OS_ANDROID) // WMPI_CAST | 51 #if defined(OS_ANDROID) // WMPI_CAST |
| 50 // Delete this file when WMPI_CAST is no longer needed. | 52 // Delete this file when WMPI_CAST is no longer needed. |
| 51 #include "media/blink/webmediaplayer_cast_android.h" | 53 #include "media/blink/webmediaplayer_cast_android.h" |
| 52 #endif | 54 #endif |
| 53 | 55 |
| 54 namespace blink { | 56 namespace blink { |
| 55 class WebLocalFrame; | 57 class WebLocalFrame; |
| 56 class WebMediaPlayerClient; | 58 class WebMediaPlayerClient; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 82 class WebAudioSourceProviderImpl; | 84 class WebAudioSourceProviderImpl; |
| 83 class WebMediaPlayerDelegate; | 85 class WebMediaPlayerDelegate; |
| 84 | 86 |
| 85 // The canonical implementation of blink::WebMediaPlayer that's backed by | 87 // The canonical implementation of blink::WebMediaPlayer that's backed by |
| 86 // Pipeline. Handles normal resource loading, Media Source, and | 88 // Pipeline. Handles normal resource loading, Media Source, and |
| 87 // Encrypted Media. | 89 // Encrypted Media. |
| 88 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl | 90 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl |
| 89 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), | 91 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), |
| 90 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), | 92 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), |
| 91 public NON_EXPORTED_BASE(Pipeline::Client), | 93 public NON_EXPORTED_BASE(Pipeline::Client), |
| 94 public NON_EXPORTED_BASE(blink::WebSurfaceLayerBridgeObserver), | |
| 92 public MediaObserverClient, | 95 public MediaObserverClient, |
| 93 public base::SupportsWeakPtr<WebMediaPlayerImpl> { | 96 public base::SupportsWeakPtr<WebMediaPlayerImpl> { |
| 94 public: | 97 public: |
| 95 // Constructs a WebMediaPlayer implementation using Chromium's media stack. | 98 // Constructs a WebMediaPlayer implementation using Chromium's media stack. |
| 96 // |delegate| and |renderer_factory_selector| must not be null. | 99 // |delegate| and |renderer_factory_selector| must not be null. |
| 97 WebMediaPlayerImpl( | 100 WebMediaPlayerImpl( |
| 98 blink::WebLocalFrame* frame, | 101 blink::WebLocalFrame* frame, |
| 99 blink::WebMediaPlayerClient* client, | 102 blink::WebMediaPlayerClient* client, |
| 100 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, | 103 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
| 101 WebMediaPlayerDelegate* delegate, | 104 WebMediaPlayerDelegate* delegate, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 gfx::Size GetCanvasSize() const; | 226 gfx::Size GetCanvasSize() const; |
| 224 void SetDeviceScaleFactor(float scale_factor); | 227 void SetDeviceScaleFactor(float scale_factor); |
| 225 void SetUseFallbackPath(bool use_fallback_path); | 228 void SetUseFallbackPath(bool use_fallback_path); |
| 226 void SetPoster(const blink::WebURL& poster) override; | 229 void SetPoster(const blink::WebURL& poster) override; |
| 227 #endif | 230 #endif |
| 228 | 231 |
| 229 // MediaObserverClient implementation. | 232 // MediaObserverClient implementation. |
| 230 void SwitchRenderer(bool is_rendered_remotely) override; | 233 void SwitchRenderer(bool is_rendered_remotely) override; |
| 231 void ActivateViewportIntersectionMonitoring(bool activate) override; | 234 void ActivateViewportIntersectionMonitoring(bool activate) override; |
| 232 | 235 |
| 236 // WebSurfaceLayerBridgeObserver implementation. | |
| 237 void OnWebLayerReplaced() override; | |
|
enne (OOO)
2017/06/26 18:35:58
I think the only reason that CanvasSurfaceLayerBri
liberato (no reviews please)
2017/06/26 22:39:30
+1. that's what i tried, badly, to say in my prev
CJ
2017/06/29 19:51:33
This looks good, but what happens when we are upda
| |
| 238 | |
| 233 // Called from WebMediaPlayerCast. | 239 // Called from WebMediaPlayerCast. |
| 234 // TODO(hubbe): WMPI_CAST make private. | 240 // TODO(hubbe): WMPI_CAST make private. |
| 235 void OnPipelineSeeked(bool time_updated); | 241 void OnPipelineSeeked(bool time_updated); |
| 236 | 242 |
| 237 // Distinct states that |delegate_| can be in. (Public for testing.) | 243 // Distinct states that |delegate_| can be in. (Public for testing.) |
| 238 enum class DelegateState { | 244 enum class DelegateState { |
| 239 GONE, | 245 GONE, |
| 240 PLAYING, | 246 PLAYING, |
| 241 PAUSED, | 247 PAUSED, |
| 242 }; | 248 }; |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 714 // Used to track loading progress, used by IsPrerollAttemptNeeded(). | 720 // Used to track loading progress, used by IsPrerollAttemptNeeded(). |
| 715 // |preroll_attempt_pending_| indicates that the clock has been reset | 721 // |preroll_attempt_pending_| indicates that the clock has been reset |
| 716 // (awaiting a resume to start), while |preroll_attempt_start_time_| tracks | 722 // (awaiting a resume to start), while |preroll_attempt_start_time_| tracks |
| 717 // when a preroll attempt began. | 723 // when a preroll attempt began. |
| 718 bool preroll_attempt_pending_; | 724 bool preroll_attempt_pending_; |
| 719 base::TimeTicks preroll_attempt_start_time_; | 725 base::TimeTicks preroll_attempt_start_time_; |
| 720 | 726 |
| 721 // Monitors the player events. | 727 // Monitors the player events. |
| 722 base::WeakPtr<MediaObserver> observer_; | 728 base::WeakPtr<MediaObserver> observer_; |
| 723 | 729 |
| 730 // Obtains and maintains SurfaceIds. | |
| 731 std::unique_ptr<blink::WebVideoSurfaceLayerBridge> bridge_; | |
| 732 | |
| 724 // The maximum video keyframe distance that allows triggering background | 733 // The maximum video keyframe distance that allows triggering background |
| 725 // playback optimizations (non-MSE). | 734 // playback optimizations (non-MSE). |
| 726 base::TimeDelta max_keyframe_distance_to_disable_background_video_; | 735 base::TimeDelta max_keyframe_distance_to_disable_background_video_; |
| 727 | 736 |
| 728 // The maximum video keyframe distance that allows triggering background | 737 // The maximum video keyframe distance that allows triggering background |
| 729 // playback optimizations (MSE). | 738 // playback optimizations (MSE). |
| 730 base::TimeDelta max_keyframe_distance_to_disable_background_video_mse_; | 739 base::TimeDelta max_keyframe_distance_to_disable_background_video_mse_; |
| 731 | 740 |
| 732 // When MSE memory pressure based garbage collection is enabled, the | 741 // When MSE memory pressure based garbage collection is enabled, the |
| 733 // |enable_instant_source_buffer_gc| controls whether the GC is done | 742 // |enable_instant_source_buffer_gc| controls whether the GC is done |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 789 OverlayInfo::RoutingToken overlay_routing_token_; | 798 OverlayInfo::RoutingToken overlay_routing_token_; |
| 790 | 799 |
| 791 OverlayInfo overlay_info_; | 800 OverlayInfo overlay_info_; |
| 792 | 801 |
| 793 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 802 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 794 }; | 803 }; |
| 795 | 804 |
| 796 } // namespace media | 805 } // namespace media |
| 797 | 806 |
| 798 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 807 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |