OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_SINK_CACHE_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_SINK_CACHE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "content/common/content_export.h" |
| 11 #include "media/base/output_device_info.h" |
| 12 |
| 13 namespace url { |
| 14 class Origin; |
| 15 } |
| 16 |
| 17 namespace media { |
| 18 class AudioRendererSink; |
| 19 } |
| 20 |
| 21 namespace content { |
| 22 |
| 23 // Caches AudioRendererSink instances (owns them), provides them to the clients |
| 24 // for usage, tracks their used/unused state, reuses them to obtain output |
| 25 // device information, garbage-collects unused sinks. |
| 26 // Thread safe. |
| 27 class CONTENT_EXPORT AudioRendererSinkCache { |
| 28 public: |
| 29 // Creates default cache, to be used by AudioRendererMixerManager. |
| 30 static std::unique_ptr<AudioRendererSinkCache> Create(); |
| 31 |
| 32 // Returnes output device information for a specified sink. |
| 33 virtual media::OutputDeviceInfo GetSinkInfo( |
| 34 int source_render_frame_id, |
| 35 int session_id, |
| 36 const std::string& device_id, |
| 37 const url::Origin& security_origin) = 0; |
| 38 |
| 39 // Provides a sink for usage. The sink must be returned to the cache by |
| 40 // calling ReleaseSink(). |
| 41 virtual scoped_refptr<media::AudioRendererSink> GetSink( |
| 42 int source_render_frame_id, |
| 43 const std::string& device_id, |
| 44 const url::Origin& security_origin) = 0; |
| 45 |
| 46 // Notifies the cache that the sink is not in use any more. Must be |
| 47 // called by the client, so that the cache can garbage-collect the sink |
| 48 // reference. |
| 49 virtual void ReleaseSink(int source_render_frame_id, |
| 50 const std::string& device_id, |
| 51 const url::Origin& security_origin, |
| 52 const media::AudioRendererSink* sink) = 0; |
| 53 |
| 54 virtual ~AudioRendererSinkCache() {} |
| 55 |
| 56 protected: |
| 57 AudioRendererSinkCache() {} |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(AudioRendererSinkCache); |
| 60 }; |
| 61 |
| 62 } // namespace content |
| 63 |
| 64 #endif // CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_SINK_CACHE_H_ |
OLD | NEW |