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

Unified Diff: webkit/media/android/webmediaplayer_manager_android.h

Issue 10533049: Adding the logic for releasing decoder resources in WebMediaPlayerManagerAndroid (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move the logic for checking whether a WMPA is active into WMPA Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: webkit/media/android/webmediaplayer_manager_android.h
diff --git a/webkit/media/android/webmediaplayer_manager_android.h b/webkit/media/android/webmediaplayer_manager_android.h
index e8a046a664d561412fc9ae3955adbf277e14e859..95eff956e519e2658d753bfaa2da081a70ea4653 100644
--- a/webkit/media/android/webmediaplayer_manager_android.h
+++ b/webkit/media/android/webmediaplayer_manager_android.h
@@ -26,6 +26,13 @@ class WebMediaPlayerManagerAndroid {
int RegisterMediaPlayer(WebMediaPlayerAndroid* player);
void UnregisterMediaPlayer(int player_id);
+ // Called when a mediaplayer starts to decode media. If the number
+ // of active decoders hits the limit, release some resources.
+ // TODO(qinmin): we need to classify between video and audio decoders.
+ // Audio decoders are inexpensive. And css animations often come with
+ // lots of small audio files.
+ void RequestMediaResources(int player_id);
+
// Release all the media resources on the renderer process.
void ReleaseMediaResources();
@@ -33,18 +40,15 @@ class WebMediaPlayerManagerAndroid {
WebMediaPlayerAndroid* GetMediaPlayer(int player_id);
private:
- // Information needed to manage WebMediaPlayerAndroid.
- // TODO(qinmin): more informations will be added here for resource management.
- struct MediaPlayerInfo {
- webkit_media::WebMediaPlayerAndroid* player;
- };
-
// Info for all available WebMediaPlayerAndroid on a page; kept so that
// we can enumerate them to send updates about tab focus and visibily.
- std::map<int32, MediaPlayerInfo> media_players_;
+ std::map<int32, webkit_media::WebMediaPlayerAndroid*> media_players_;
scherkus (not reviewing) 2012/06/07 21:44:34 nit: you're in webkit_media namespace so no need t
qinmin 2012/06/08 17:09:06 Done.
int32 next_media_player_id_;
+ // Number of active players.
+ int32 num_active_players_;
+
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerManagerAndroid);
};

Powered by Google App Engine
This is Rietveld 408576698