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

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

Issue 10636036: Enable renderer side mixing behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renderer Side Mixing! Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 // Manages sharing of an AudioRendererMixer among AudioRendererMixerInputs based
scherkus (not reviewing) 2012/07/13 18:40:16 nit: we (media code) has typically put these along
DaleCurtis 2012/07/13 21:28:33 Done.
6 // on their AudioParameters configuration. Inputs with the same AudioParameters
7 // configuration will share a mixer. While a new AudioRendererMixer will be
scherkus (not reviewing) 2012/07/13 18:40:16 s/. While/ while/
DaleCurtis 2012/07/13 21:28:33 Done.
8 // lazily created if one with the exact AudioParameters does not exist.
9 //
10 // There should only be one instance of AudioRendererMixerManager per render
11 // thread.
12 //
13 // TODO(dalecurtis): Right now we require AudioParameters to be an exact match
14 // when we should be able to ignore bits per channel since we're only dealing
15 // with floats. However, bits per channel is currently used to interleave the
16 // audio data by AudioDevice::AudioThreadCallback::Process for consumption via
17 // the shared memory. See http://crbug.com/114700.
18
19 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_
20 #define CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_
21
22 #include <map>
23
24 #include "base/memory/ref_counted.h"
25 #include "base/synchronization/lock.h"
26 #include "content/common/content_export.h"
27 #include "media/audio/audio_parameters.h"
28
29 namespace media {
30 class AudioRendererMixer;
31 class AudioRendererMixerInput;
32 }
33
34 class CONTENT_EXPORT AudioRendererMixerManager {
jochen (gone - plz use gerrit) 2012/07/13 08:51:03 all code in content/ should go into namespace cont
DaleCurtis 2012/07/13 21:28:33 Done. I noticed the classes I was interacting wit
35 public:
36 AudioRendererMixerManager();
37 virtual ~AudioRendererMixerManager();
scherkus (not reviewing) 2012/07/13 18:40:16 remove virtual -- I'm not seeing any virtualness i
DaleCurtis 2012/07/13 21:28:33 Done.
38
39 // Returns an AudioRendererMixerInput.
40 scoped_refptr<media::AudioRendererMixerInput> CreateInput();
jochen (gone - plz use gerrit) 2012/07/13 08:51:03 why not just return a raw pointer? that way, the m
DaleCurtis 2012/07/13 21:28:33 Done.
41
42 private:
43 friend class AudioRendererMixerManagerTest;
jochen (gone - plz use gerrit) 2012/07/13 08:51:03 please use FRIEND_TEST_ALL_PREFIXES
DaleCurtis 2012/07/13 21:28:33 I don't think that's necessary here? I only access
44
45 // Returns a mixer instance based on AudioParameters; an existing one if one
46 // with the provided AudioParameters exists or a new one if not.
47 media::AudioRendererMixer* GetMixer(const media::AudioParameters& params);
48
49 // Remove a mixer instance given a mixer if the only other reference is held
50 // by AudioRendererMixerManager. Every AudioRendererMixer owner must call
51 // this method when it's done with a mixer.
52 void RemoveMixer(const media::AudioParameters& params);
53
54 // Map of AudioParameters to <AudioRendererMixer, Count>. Count allows
55 // AudioRendererMixerManager to keep track explicitly (v.s. RefCounting which
56 // is implicit) of the number of outstanding AudioRendererMixers.
57 typedef std::map<media::AudioParameters,
58 std::pair<media::AudioRendererMixer*,int>,
scherkus (not reviewing) 2012/07/13 18:40:16 s/,int/, int/ Alternatively can use a struct so c
DaleCurtis 2012/07/13 21:28:33 Done.
59 media::AudioParameters::Compare> AudioRendererMixerMap;
60 AudioRendererMixerMap mixer_map_;
61 base::Lock mixer_map_lock_;
scherkus (not reviewing) 2012/07/13 18:40:16 which threads interact with this class requiring a
DaleCurtis 2012/07/13 21:28:33 ARMM is constructed on the render thread, GetMixer
62
63 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerManager);
64 };
65
66 #endif // CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698