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

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

Issue 2471903002: Add MediaServiceThrottler (Closed)
Patch Set: Integrate throttler into MediaPlayerRender Created 4 years, 1 month 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
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"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 InitializeInternal(
100 media::DemuxerStreamProvider* demuxer_stream_provider);
101
99 // Used when creating |media_player_|. 102 // Used when creating |media_player_|.
100 void OnDecoderResourcesReleased(int player_id); 103 void OnDecoderResourcesReleased(int player_id);
101 104
102 // Cancels the pending request started by InitiateScopedSurfaceRequest(), if 105 // Cancels the pending request started by InitiateScopedSurfaceRequest(), if
103 // it exists. No-ops otherwise. 106 // it exists. No-ops otherwise.
104 void CancelScopedSurfaceRequest(); 107 void CancelScopedSurfaceRequest();
105 108
106 RenderFrameHost* render_frame_host_; 109 RenderFrameHost* render_frame_host_;
107 media::RendererClient* renderer_client_; 110 media::RendererClient* renderer_client_;
108 111
112 media::PipelineStatusCB pending_init_cb_;
113
109 std::unique_ptr<media::MediaPlayerBridge> media_player_; 114 std::unique_ptr<media::MediaPlayerBridge> media_player_;
110 115
111 // Current duration of the media. 116 // Current duration of the media.
112 base::TimeDelta duration_; 117 base::TimeDelta duration_;
113 118
114 // Indicates if a serious error has been encountered by the |media_player_|. 119 // Indicates if a serious error has been encountered by the |media_player_|.
115 bool has_error_; 120 bool has_error_;
116 121
117 gfx::Size video_size_; 122 gfx::Size video_size_;
118 123
119 base::UnguessableToken surface_request_token_; 124 base::UnguessableToken surface_request_token_;
120 125
121 std::unique_ptr<media::MediaResourceGetter> media_resource_getter_; 126 std::unique_ptr<media::MediaResourceGetter> media_resource_getter_;
122 127
123 // NOTE: Weak pointers must be invalidated before all other member variables. 128 // NOTE: Weak pointers must be invalidated before all other member variables.
124 base::WeakPtrFactory<MediaPlayerRenderer> weak_factory_; 129 base::WeakPtrFactory<MediaPlayerRenderer> weak_factory_;
125 130
126 DISALLOW_COPY_AND_ASSIGN(MediaPlayerRenderer); 131 DISALLOW_COPY_AND_ASSIGN(MediaPlayerRenderer);
127 }; 132 };
128 133
129 } // namespace content 134 } // namespace content
130 135
131 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_PLAYER_RENDERER_H_ 136 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_PLAYER_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698