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

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: rebase 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 using the currently registered factory
30 // and the default audio output device.
25 // |render_frame_id| refers to the RenderFrame containing the entity 31 // |render_frame_id| refers to the RenderFrame containing the entity
26 // producing the audio. 32 // producing the audio.
27 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice( 33 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
DaleCurtis 2015/09/12 01:17:19 Do we have callers for all of these methods? I fee
Guido Urdaneta 2015/09/14 11:35:48 Done.
28 int render_frame_id); 34 int render_frame_id);
29 35
36 // Creates an AudioOutputDevice.
37 // |render_frame_id| refers to the RenderFrame containing the entity
38 // producing the audio. |session_id| is used for the browser to select the
39 // correct input device ID and its associated output device, if it exists.
40 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
41 int render_frame_id,
42 int session_id);
43
44 // Creates an AudioOutputDevice.
45 // |render_frame_id| refers to the RenderFrame containing the entity
46 // producing the audio. |device_id| and |security_origin| identify the
47 // output device to use.
48 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
49 int render_frame_id,
50 const std::string& device_id,
51 const GURL& security_origin);
52
30 // Creates an AudioInputDevice using the currently registered factory. 53 // Creates an AudioInputDevice using the currently registered factory.
31 // |render_frame_id| refers to the RenderFrame containing the entity 54 // |render_frame_id| refers to the RenderFrame containing the entity
32 // consuming the audio. 55 // consuming the audio.
33 static scoped_refptr<media::AudioInputDevice> NewInputDevice( 56 static scoped_refptr<media::AudioInputDevice> NewInputDevice(
34 int render_frame_id); 57 int render_frame_id);
35 58
36 protected: 59 protected:
37 AudioDeviceFactory(); 60 AudioDeviceFactory();
38 virtual ~AudioDeviceFactory(); 61 virtual ~AudioDeviceFactory();
39 62
40 // You can derive from this class and specify an implementation for these 63 // You can derive from this class and specify an implementation for these
41 // functions to provide alternate audio device implementations. 64 // functions to provide alternate audio device implementations.
42 // If the return value of either of these function is NULL, we fall back 65 // If the return value of either of these function is NULL, we fall back
43 // on the default implementation. 66 // on the default implementation.
44 virtual media::AudioOutputDevice* CreateOutputDevice(int render_frame_id) = 0; 67 virtual media::AudioOutputDevice* CreateOutputDevice(int render_frame_id) = 0;
68 virtual media::AudioOutputDevice* CreateOutputDevice(int render_frame_id,
69 int session_id) = 0;
70 virtual media::AudioOutputDevice* CreateOutputDevice(
71 int render_frame_id,
72 const std::string& device_id,
73 const GURL& security_origin) = 0;
45 virtual media::AudioInputDevice* CreateInputDevice(int render_frame_id) = 0; 74 virtual media::AudioInputDevice* CreateInputDevice(int render_frame_id) = 0;
46 75
47 private: 76 private:
48 // The current globally registered factory. This is NULL when we should 77 // The current globally registered factory. This is NULL when we should
49 // create the default AudioRendererSinks. 78 // create the default AudioRendererSinks.
50 static AudioDeviceFactory* factory_; 79 static AudioDeviceFactory* factory_;
51 80
52 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); 81 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory);
53 }; 82 };
54 83
55 } // namespace content 84 } // namespace content
56 85
57 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ 86 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698