| OLD | NEW |
| 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 CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ |
| 6 #define CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ | 6 #define CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // TODO(tianyuwang): change stream_type to use a enum. | 42 // TODO(tianyuwang): change stream_type to use a enum. |
| 43 void SetVolumeMultiplier(int stream_type, float volume); | 43 void SetVolumeMultiplier(int stream_type, float volume); |
| 44 | 44 |
| 45 base::SingleThreadTaskRunner* task_runner() const { | 45 base::SingleThreadTaskRunner* task_runner() const { |
| 46 return media_task_runner_.get(); | 46 return media_task_runner_.get(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 friend class MediaPipelineBackendWrapper; | 50 friend class MediaPipelineBackendWrapper; |
| 51 | 51 |
| 52 // Backend wrapper instances must use these APIs when allocating and releasing |
| 53 // decoder objects, so we can enforce global limit on #concurrent decoders. |
| 54 bool IncrementAudioDecoderCount(); |
| 55 bool IncrementVideoDecoderCount(); |
| 56 void DecrementAudioDecoderCount(); |
| 57 void DecrementVideoDecoderCount(); |
| 58 |
| 52 // Internal clean up when a new media pipeline backend is destroyed. | 59 // Internal clean up when a new media pipeline backend is destroyed. |
| 53 void OnMediaPipelineBackendDestroyed(const MediaPipelineBackend* backend); | 60 void OnMediaPipelineBackendDestroyed(const MediaPipelineBackend* backend); |
| 54 | 61 |
| 55 float GetVolumeMultiplier(int stream_type); | 62 float GetVolumeMultiplier(int stream_type); |
| 56 | 63 |
| 57 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 64 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
| 58 | 65 |
| 59 // A vector that stores all of the existing media_pipeline_backends_. | 66 // A vector that stores all of the existing media_pipeline_backends_. |
| 60 std::vector<MediaPipelineBackend*> media_pipeline_backends_; | 67 std::vector<MediaPipelineBackend*> media_pipeline_backends_; |
| 61 | 68 |
| 69 // Total count of decoders created |
| 70 int audio_decoder_count_; |
| 71 int video_decoder_count_; |
| 72 |
| 62 // Volume multiplier for each type of audio streams. | 73 // Volume multiplier for each type of audio streams. |
| 63 std::map<int, float> volume_by_stream_type_; | 74 std::map<int, float> volume_by_stream_type_; |
| 64 | 75 |
| 65 DISALLOW_COPY_AND_ASSIGN(MediaPipelineBackendManager); | 76 DISALLOW_COPY_AND_ASSIGN(MediaPipelineBackendManager); |
| 66 }; | 77 }; |
| 67 | 78 |
| 68 } // namespace media | 79 } // namespace media |
| 69 } // namespace chromecast | 80 } // namespace chromecast |
| 70 | 81 |
| 71 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ | 82 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ |
| OLD | NEW |