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

Unified Diff: chromecast/media/cma/backend/media_pipeline_backend_manager.h

Issue 2173593002: [Chromecast] Limit number of concurrent audio and video decoders (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use enum for decoder type Created 4 years, 5 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
« no previous file with comments | « no previous file | chromecast/media/cma/backend/media_pipeline_backend_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/media/cma/backend/media_pipeline_backend_manager.h
diff --git a/chromecast/media/cma/backend/media_pipeline_backend_manager.h b/chromecast/media/cma/backend/media_pipeline_backend_manager.h
index 54e6f205ad0e4d2cdfdbedb5c4fa01c2035ae031..3cb327609c5321642c77e1baca888dcec900ece5 100644
--- a/chromecast/media/cma/backend/media_pipeline_backend_manager.h
+++ b/chromecast/media/cma/backend/media_pipeline_backend_manager.h
@@ -23,6 +23,8 @@ namespace media {
// All functions in this class should be called on the media thread.
class MediaPipelineBackendManager {
public:
+ enum DecoderType { AUDIO_DECODER, VIDEO_DECODER, NUM_DECODER_TYPES };
+
explicit MediaPipelineBackendManager(
scoped_refptr<base::SingleThreadTaskRunner> media_task_runner);
~MediaPipelineBackendManager();
@@ -49,6 +51,11 @@ class MediaPipelineBackendManager {
private:
friend class MediaPipelineBackendWrapper;
+ // Backend wrapper instances must use these APIs when allocating and releasing
+ // decoder objects, so we can enforce global limit on #concurrent decoders.
+ bool IncrementDecoderCount(DecoderType type);
+ void DecrementDecoderCount(DecoderType type);
+
// Internal clean up when a new media pipeline backend is destroyed.
void OnMediaPipelineBackendDestroyed(const MediaPipelineBackend* backend);
@@ -59,6 +66,9 @@ class MediaPipelineBackendManager {
// A vector that stores all of the existing media_pipeline_backends_.
std::vector<MediaPipelineBackend*> media_pipeline_backends_;
+ // Total count of decoders created
+ int decoder_count_[NUM_DECODER_TYPES];
+
// Volume multiplier for each type of audio streams.
std::map<int, float> volume_by_stream_type_;
« no previous file with comments | « no previous file | chromecast/media/cma/backend/media_pipeline_backend_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698