Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_PLAYER_RENDERER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_PLAYER_RENDERER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_PLAYER_RENDERER_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_PLAYER_RENDERER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 // returns the token associated to the request. The token can then be used to | 89 // returns the token associated to the request. The token can then be used to |
| 90 // complete the request via the gpu::ScopedSurfaceRequestConduit. | 90 // complete the request via the gpu::ScopedSurfaceRequestConduit. |
| 91 // A completed request will call back to OnScopedSurfaceRequestCompleted(). | 91 // A completed request will call back to OnScopedSurfaceRequestCompleted(). |
| 92 // | 92 // |
| 93 // NOTE: If a request is already pending, calling this method again will | 93 // NOTE: If a request is already pending, calling this method again will |
| 94 // safely cancel the pending request before registering a new one. | 94 // safely cancel the pending request before registering a new one. |
| 95 base::UnguessableToken InitiateScopedSurfaceRequest(); | 95 base::UnguessableToken InitiateScopedSurfaceRequest(); |
| 96 void OnScopedSurfaceRequestCompleted(gl::ScopedJavaSurface surface); | 96 void OnScopedSurfaceRequestCompleted(gl::ScopedJavaSurface surface); |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 void CreateUnderlyingMediaPlayer(const media::MediaUrlParams& params); | |
|
DaleCurtis
2016/11/11 23:32:15
Just CreateMediaPlayer?
tguilbert
2016/11/14 23:18:07
Done.
| |
| 100 | |
| 99 // Used when creating |media_player_|. | 101 // Used when creating |media_player_|. |
| 100 void OnDecoderResourcesReleased(int player_id); | 102 void OnDecoderResourcesReleased(int player_id); |
| 101 | 103 |
| 102 // Cancels the pending request started by InitiateScopedSurfaceRequest(), if | 104 // Cancels the pending request started by InitiateScopedSurfaceRequest(), if |
| 103 // it exists. No-ops otherwise. | 105 // it exists. No-ops otherwise. |
| 104 void CancelScopedSurfaceRequest(); | 106 void CancelScopedSurfaceRequest(); |
| 105 | 107 |
| 106 RenderFrameHost* render_frame_host_; | 108 RenderFrameHost* render_frame_host_; |
| 107 media::RendererClient* renderer_client_; | 109 media::RendererClient* renderer_client_; |
| 108 | 110 |
| 111 media::PipelineStatusCB pending_init_cb_; | |
| 112 | |
| 109 std::unique_ptr<media::MediaPlayerBridge> media_player_; | 113 std::unique_ptr<media::MediaPlayerBridge> media_player_; |
| 110 | 114 |
| 111 // Current duration of the media. | 115 // Current duration of the media. |
| 112 base::TimeDelta duration_; | 116 base::TimeDelta duration_; |
| 113 | 117 |
| 114 // Indicates if a serious error has been encountered by the |media_player_|. | 118 // Indicates if a serious error has been encountered by the |media_player_|. |
| 115 bool has_error_; | 119 bool has_error_; |
| 116 | 120 |
| 117 gfx::Size video_size_; | 121 gfx::Size video_size_; |
| 118 | 122 |
| 119 base::UnguessableToken surface_request_token_; | 123 base::UnguessableToken surface_request_token_; |
| 120 | 124 |
| 121 std::unique_ptr<media::MediaResourceGetter> media_resource_getter_; | 125 std::unique_ptr<media::MediaResourceGetter> media_resource_getter_; |
| 122 | 126 |
| 123 // NOTE: Weak pointers must be invalidated before all other member variables. | 127 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 124 base::WeakPtrFactory<MediaPlayerRenderer> weak_factory_; | 128 base::WeakPtrFactory<MediaPlayerRenderer> weak_factory_; |
| 125 | 129 |
| 126 DISALLOW_COPY_AND_ASSIGN(MediaPlayerRenderer); | 130 DISALLOW_COPY_AND_ASSIGN(MediaPlayerRenderer); |
| 127 }; | 131 }; |
| 128 | 132 |
| 129 } // namespace content | 133 } // namespace content |
| 130 | 134 |
| 131 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_PLAYER_RENDERER_H_ | 135 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_PLAYER_RENDERER_H_ |
| OLD | NEW |