Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: content/browser/media/android/media_player_renderer.h

Issue 2282633002: Integrate Surface requests with MediaPlayerRenderer (Closed)
Patch Set: Addressed last comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/media/android/media_player_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/unguessable_token.h"
11 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
12 #include "content/public/browser/render_frame_host.h" 13 #include "content/public/browser/render_frame_host.h"
13 #include "media/base/android/media_player_bridge.h" 14 #include "media/base/android/media_player_bridge.h"
14 #include "media/base/android/media_player_manager.h" 15 #include "media/base/android/media_player_manager.h"
15 #include "media/base/demuxer_stream_provider.h" 16 #include "media/base/demuxer_stream_provider.h"
16 #include "media/base/media_log.h" 17 #include "media/base/media_log.h"
17 #include "media/base/renderer.h" 18 #include "media/base/renderer.h"
18 #include "media/base/renderer_client.h" 19 #include "media/base/renderer_client.h"
19 #include "url/gurl.h" 20 #include "url/gurl.h"
20 21
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void OnSeekComplete(int player_id, 78 void OnSeekComplete(int player_id,
78 const base::TimeDelta& current_time) override; 79 const base::TimeDelta& current_time) override;
79 void OnError(int player_id, int error) override; 80 void OnError(int player_id, int error) override;
80 void OnVideoSizeChanged(int player_id, int width, int height) override; 81 void OnVideoSizeChanged(int player_id, int width, int height) override;
81 media::MediaPlayerAndroid* GetFullscreenPlayer() override; 82 media::MediaPlayerAndroid* GetFullscreenPlayer() override;
82 media::MediaPlayerAndroid* GetPlayer(int player_id) override; 83 media::MediaPlayerAndroid* GetPlayer(int player_id) override;
83 bool RequestPlay(int player_id, 84 bool RequestPlay(int player_id,
84 base::TimeDelta duration, 85 base::TimeDelta duration,
85 bool has_audio) override; 86 bool has_audio) override;
86 87
88 // Registers a request in the content::ScopedSurfaceRequestManager, and
89 // returns the token associated to the request. The token can then be used to
90 // complete the request via the gpu::ScopedSurfaceRequestConduit.
91 // A completed request will call back to OnScopedSurfaceRequestCompleted().
92 //
93 // NOTE: If a request is already pending, calling this method again will
94 // safely cancel the pending request before registering a new one.
95 base::UnguessableToken InitiateScopedSurfaceRequest();
96 void OnScopedSurfaceRequestCompleted(gl::ScopedJavaSurface surface);
97
87 private: 98 private:
88 // Used when creating |media_player_|. 99 // Used when creating |media_player_|.
89 void OnDecoderResourcesReleased(int player_id); 100 void OnDecoderResourcesReleased(int player_id);
90 101
102 // Cancels the pending request started by InitiateScopedSurfaceRequest(), if
103 // it exists. No-ops otherwise.
104 void CancelScopedSurfaceRequest();
105
91 RenderFrameHost* render_frame_host_; 106 RenderFrameHost* render_frame_host_;
92 media::RendererClient* renderer_client_; 107 media::RendererClient* renderer_client_;
93 108
94 std::unique_ptr<media::MediaPlayerBridge> media_player_; 109 std::unique_ptr<media::MediaPlayerBridge> media_player_;
95 110
96 // Current duration of the media. 111 // Current duration of the media.
97 base::TimeDelta duration_; 112 base::TimeDelta duration_;
98 113
99 // Indicates if a serious error has been encountered by the |media_player_|. 114 // Indicates if a serious error has been encountered by the |media_player_|.
100 bool has_error_; 115 bool has_error_;
101 116
102 gfx::Size video_size_; 117 gfx::Size video_size_;
103 118
119 base::UnguessableToken surface_request_token_;
120
104 std::unique_ptr<media::MediaResourceGetter> media_resource_getter_; 121 std::unique_ptr<media::MediaResourceGetter> media_resource_getter_;
105 122
106 // NOTE: Weak pointers must be invalidated before all other member variables. 123 // NOTE: Weak pointers must be invalidated before all other member variables.
107 base::WeakPtrFactory<MediaPlayerRenderer> weak_factory_; 124 base::WeakPtrFactory<MediaPlayerRenderer> weak_factory_;
108 125
109 DISALLOW_COPY_AND_ASSIGN(MediaPlayerRenderer); 126 DISALLOW_COPY_AND_ASSIGN(MediaPlayerRenderer);
110 }; 127 };
111 128
112 } // namespace content 129 } // namespace content
113 130
114 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_PLAYER_RENDERER_H_ 131 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_PLAYER_RENDERER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/android/media_player_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698