Index: content/renderer/media/audio_renderer_sink_cache.h |
diff --git a/content/renderer/media/audio_renderer_sink_cache.h b/content/renderer/media/audio_renderer_sink_cache.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..168ec01a9f6ce703029abfa7bd4c704795c78a4a |
--- /dev/null |
+++ b/content/renderer/media/audio_renderer_sink_cache.h |
@@ -0,0 +1,58 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_SINK_CACHE_H_ |
+#define CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_SINK_CACHE_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/weak_ptr.h" |
miu
2016/05/12 21:53:06
This include doesn't seem to be used.
o1ka
2016/05/17 17:17:24
Done.
|
+#include "content/common/content_export.h" |
+#include "media/base/output_device_info.h" |
+#include "url/origin.h" |
miu
2016/05/12 21:53:06
nit: Chromium code takes the opposite stance from
o1ka
2016/05/17 17:17:24
Done.
|
+ |
+namespace media { |
+class AudioRendererSink; |
+} |
+ |
+namespace content { |
+ |
+// Caches AudioRendererSink instances (owns them), provides them to the clients |
+// for usage, tracks their used/unused state, garbage-collects unused sinks. |
+// Thread safe. |
+class CONTENT_EXPORT AudioRendererSinkCache { |
miu
2016/05/12 21:53:06
naming nit: This feels more like a "pool" than a "
o1ka
2016/05/17 17:17:24
Now it does not quite manage the lifetime any more
|
+ public: |
+ // Creates default cache, to be used by AudioRendererMixerManager. |
+ static std::unique_ptr<AudioRendererSinkCache> CreateDefault(); |
+ |
+ // Returnes output device information for a specified sink. |
+ virtual media::OutputDeviceInfo GetSinkInfo( |
+ int source_render_frame_id, |
+ int session_id, |
+ const std::string& device_id, |
+ const url::Origin& security_origin) = 0; |
+ |
+ // Provides a sink for usage. The sink must be returned to the cache by |
+ // calling ReleaseSink(). Does not pass sink ownership; sink is guaranteed to |
+ // be alive until ReleaseSink(). |
+ virtual media::AudioRendererSink* GetSink( |
+ int source_render_frame_id, |
+ const std::string& device_id, |
+ const url::Origin& security_origin) = 0; |
+ |
+ // Returns the sink to the chache when it's not needed any more. Must be |
+ // called by the client, so that the cache can garbage-collect the sink. |
+ virtual void ReleaseSink(media::AudioRendererSink* sink) = 0; |
+ |
+ virtual ~AudioRendererSinkCache() {} |
+ |
+ protected: |
+ AudioRendererSinkCache() {} |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AudioRendererSinkCache); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_SINK_CACHE_H_ |