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

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: Rebase, fix for sleep() compile error on win and a bit of cleanup around timeouts. Created 4 years, 7 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 "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.
11 #include "content/common/content_export.h"
12 #include "media/base/output_device_info.h"
13 #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.
14
15 namespace media {
16 class AudioRendererSink;
17 }
18
19 namespace content {
20
21 // Caches AudioRendererSink instances (owns them), provides them to the clients
22 // for usage, tracks their used/unused state, garbage-collects unused sinks.
23 // Thread safe.
24 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
25 public:
26 // Creates default cache, to be used by AudioRendererMixerManager.
27 static std::unique_ptr<AudioRendererSinkCache> CreateDefault();
28
29 // Returnes output device information for a specified sink.
30 virtual media::OutputDeviceInfo GetSinkInfo(
31 int source_render_frame_id,
32 int session_id,
33 const std::string& device_id,
34 const url::Origin& security_origin) = 0;
35
36 // Provides a sink for usage. The sink must be returned to the cache by
37 // calling ReleaseSink(). Does not pass sink ownership; sink is guaranteed to
38 // be alive until ReleaseSink().
39 virtual media::AudioRendererSink* GetSink(
40 int source_render_frame_id,
41 const std::string& device_id,
42 const url::Origin& security_origin) = 0;
43
44 // Returns the sink to the chache when it's not needed any more. Must be
45 // called by the client, so that the cache can garbage-collect the sink.
46 virtual void ReleaseSink(media::AudioRendererSink* sink) = 0;
47
48 virtual ~AudioRendererSinkCache() {}
49
50 protected:
51 AudioRendererSinkCache() {}
52
53 DISALLOW_COPY_AND_ASSIGN(AudioRendererSinkCache);
54 };
55
56 } // namespace content
57
58 #endif // CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_SINK_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698