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 CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 media::MediaPlayerManager* manager, | 151 media::MediaPlayerManager* manager, |
152 BrowserDemuxerAndroid* demuxer); | 152 BrowserDemuxerAndroid* demuxer); |
153 | 153 |
154 // MediaPlayerAndroid must call this before it is going to decode | 154 // MediaPlayerAndroid must call this before it is going to decode |
155 // media streams. This helps the manager object maintain an array | 155 // media streams. This helps the manager object maintain an array |
156 // of active MediaPlayerAndroid objects and release the resources | 156 // of active MediaPlayerAndroid objects and release the resources |
157 // when needed. Currently we only count video resources as they are | 157 // when needed. Currently we only count video resources as they are |
158 // constrained by hardware and memory limits. | 158 // constrained by hardware and memory limits. |
159 virtual void OnMediaResourcesRequested(int player_id); | 159 virtual void OnMediaResourcesRequested(int player_id); |
160 | 160 |
161 // Similar to the above call, MediaPlayerAndroid must call this method when | 161 // Called when a player releases all decoding resources. |
162 // releasing all the decoding resources. | 162 void ReleaseMediaResources(int player_id); |
163 virtual void OnMediaResourcesReleased(int player_id); | 163 |
| 164 // Releases the player. However, don't remove it from |players_|. |
| 165 void ReleasePlayer(media::MediaPlayerAndroid* player); |
164 | 166 |
165 #if defined(VIDEO_HOLE) | 167 #if defined(VIDEO_HOLE) |
166 void OnRequestExternalSurface(int player_id, const gfx::RectF& rect); | 168 void OnRequestExternalSurface(int player_id, const gfx::RectF& rect); |
167 #endif // defined(VIDEO_HOLE) | 169 #endif // defined(VIDEO_HOLE) |
168 | 170 |
169 RenderFrameHost* const render_frame_host_; | 171 RenderFrameHost* const render_frame_host_; |
170 | 172 |
171 // An array of managed players. | 173 // An array of managed players. |
172 ScopedVector<media::MediaPlayerAndroid> players_; | 174 ScopedVector<media::MediaPlayerAndroid> players_; |
173 | 175 |
(...skipping 18 matching lines...) Expand all Loading... |
192 | 194 |
193 // NOTE: Weak pointers must be invalidated before all other member variables. | 195 // NOTE: Weak pointers must be invalidated before all other member variables. |
194 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; | 196 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; |
195 | 197 |
196 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); | 198 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); |
197 }; | 199 }; |
198 | 200 |
199 } // namespace content | 201 } // namespace content |
200 | 202 |
201 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 203 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
OLD | NEW |