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

Side by Side Diff: content/renderer/media/audio_renderer_sink_cache.h

Issue 1942803002: Caching AudioOutputDevice instances in mixer manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments fixed Created 4 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 unified diff | Download patch
OLDNEW
(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, provides them to the clients for usage,
24 // tracks their used/unused state, reuses them to obtain output device
25 // information, garbage-collects unused sinks.
26 // Thread safe.
27 class CONTENT_EXPORT AudioRendererSinkCache {
28 public:
29 virtual ~AudioRendererSinkCache() {}
30
31 // Creates default cache, to be used by AudioRendererMixerManager.
32 static std::unique_ptr<AudioRendererSinkCache> Create();
33
34 // Returns output device information for a specified sink.
35 virtual media::OutputDeviceInfo GetSinkInfo(
36 int source_render_frame_id,
37 int session_id,
38 const std::string& device_id,
39 const url::Origin& security_origin) = 0;
40
41 // Provides a sink for usage. The sink must be returned to the cache by
42 // calling ReleaseSink(). The sink must be stopped by the user before
43 // deletion, but after releasing it from the cache.
44 virtual scoped_refptr<media::AudioRendererSink> GetSink(
45 int source_render_frame_id,
46 const std::string& device_id,
47 const url::Origin& security_origin) = 0;
48
49 // Notifies the cache that the sink is not in use any more. Must be
50 // called by the client, so that the cache can garbage-collect the sink
51 // reference.
52 virtual void ReleaseSink(const media::AudioRendererSink* sink_ptr) = 0;
53
54 protected:
55 AudioRendererSinkCache() {}
56
57 DISALLOW_COPY_AND_ASSIGN(AudioRendererSinkCache);
58 };
59
60 } // namespace content
61
62 #endif // CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_SINK_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698