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

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

Issue 1323403005: Allow AudioOutputDevice objects to be initialized with a specific hardware output device and store … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert DCHECK in destructor Created 5 years, 3 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_
6 #define CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ 6 #define CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_
7 7
8 #include <string>
9
8 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
11 14
15 class GURL;
16
12 namespace media { 17 namespace media {
13 class AudioInputDevice; 18 class AudioInputDevice;
14 class AudioOutputDevice; 19 class AudioOutputDevice;
15 } 20 }
16 21
17 namespace content { 22 namespace content {
18 23
19 // A factory for creating AudioOutputDevices and AudioInputDevices. There is a 24 // A factory for creating AudioOutputDevices and AudioInputDevices. There is a
20 // global factory function that can be installed for the purposes of testing to 25 // global factory function that can be installed for the purposes of testing to
21 // provide specialized implementations. 26 // provide specialized implementations.
22 class CONTENT_EXPORT AudioDeviceFactory { 27 class CONTENT_EXPORT AudioDeviceFactory {
23 public: 28 public:
24 // Creates an AudioOutputDevice using the currently registered factory. 29 // Creates an AudioOutputDevice.
25 // |render_frame_id| refers to the RenderFrame containing the entity 30 // |render_frame_id| refers to the RenderFrame containing the entity
26 // producing the audio. 31 // producing the audio. If |session_id| is nonzero, it is used by the browser
32 // to select the correct input device ID and its associated output device, if
33 // it exists. If |session_id| is zero, |device_id| and |security_origin|
34 // identify the output device to use.
35 // If |session_id| is zero and |device_id| and |security_origin| are empty,
36 // the default output device will be selected.
27 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice( 37 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
28 int render_frame_id); 38 int render_frame_id,
39 int session_id,
40 const std::string& device_id,
41 const GURL& security_origin);
29 42
30 // Creates an AudioInputDevice using the currently registered factory. 43 // Creates an AudioInputDevice using the currently registered factory.
31 // |render_frame_id| refers to the RenderFrame containing the entity 44 // |render_frame_id| refers to the RenderFrame containing the entity
32 // consuming the audio. 45 // consuming the audio.
33 static scoped_refptr<media::AudioInputDevice> NewInputDevice( 46 static scoped_refptr<media::AudioInputDevice> NewInputDevice(
34 int render_frame_id); 47 int render_frame_id);
35 48
36 protected: 49 protected:
37 AudioDeviceFactory(); 50 AudioDeviceFactory();
38 virtual ~AudioDeviceFactory(); 51 virtual ~AudioDeviceFactory();
39 52
40 // You can derive from this class and specify an implementation for these 53 // You can derive from this class and specify an implementation for these
41 // functions to provide alternate audio device implementations. 54 // functions to provide alternate audio device implementations.
42 // If the return value of either of these function is NULL, we fall back 55 // If the return value of either of these function is NULL, we fall back
43 // on the default implementation. 56 // on the default implementation.
44 virtual media::AudioOutputDevice* CreateOutputDevice(int render_frame_id) = 0; 57 virtual media::AudioOutputDevice* CreateOutputDevice(
58 int render_frame_id,
59 int sesssion_id,
60 const std::string& device_id,
61 const GURL& security_origin) = 0;
45 virtual media::AudioInputDevice* CreateInputDevice(int render_frame_id) = 0; 62 virtual media::AudioInputDevice* CreateInputDevice(int render_frame_id) = 0;
46 63
47 private: 64 private:
48 // The current globally registered factory. This is NULL when we should 65 // The current globally registered factory. This is NULL when we should
49 // create the default AudioRendererSinks. 66 // create the default AudioRendererSinks.
50 static AudioDeviceFactory* factory_; 67 static AudioDeviceFactory* factory_;
51 68
52 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); 69 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory);
53 }; 70 };
54 71
55 } // namespace content 72 } // namespace content
56 73
57 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ 74 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698