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

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: Palmer's comments 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
12 namespace media { 15 namespace media {
13 class AudioInputDevice; 16 class AudioInputDevice;
14 class AudioOutputDevice; 17 class AudioOutputDevice;
15 } 18 }
16 19
20 namespace url {
21 class Origin;
22 }
23
17 namespace content { 24 namespace content {
18 25
19 // A factory for creating AudioOutputDevices and AudioInputDevices. There is a 26 // A factory for creating AudioOutputDevices and AudioInputDevices. There is a
20 // global factory function that can be installed for the purposes of testing to 27 // global factory function that can be installed for the purposes of testing to
21 // provide specialized implementations. 28 // provide specialized implementations.
22 class CONTENT_EXPORT AudioDeviceFactory { 29 class CONTENT_EXPORT AudioDeviceFactory {
23 public: 30 public:
24 // Creates an AudioOutputDevice using the currently registered factory. 31 // Creates an AudioOutputDevice.
25 // |render_frame_id| refers to the RenderFrame containing the entity 32 // |render_frame_id| refers to the RenderFrame containing the entity
26 // producing the audio. 33 // producing the audio. If |session_id| is nonzero, it is used by the browser
34 // to select the correct input device ID and its associated output device, if
35 // it exists. If |session_id| is zero, |device_id| and |security_origin|
36 // identify the output device to use.
37 // If |session_id| is zero and |device_id| and |security_origin| are empty,
38 // the default output device will be selected.
27 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice( 39 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
28 int render_frame_id); 40 int render_frame_id,
41 int session_id,
42 const std::string& device_id,
43 const url::Origin& security_origin);
29 44
30 // Creates an AudioInputDevice using the currently registered factory. 45 // Creates an AudioInputDevice using the currently registered factory.
31 // |render_frame_id| refers to the RenderFrame containing the entity 46 // |render_frame_id| refers to the RenderFrame containing the entity
32 // consuming the audio. 47 // consuming the audio.
33 static scoped_refptr<media::AudioInputDevice> NewInputDevice( 48 static scoped_refptr<media::AudioInputDevice> NewInputDevice(
34 int render_frame_id); 49 int render_frame_id);
35 50
36 protected: 51 protected:
37 AudioDeviceFactory(); 52 AudioDeviceFactory();
38 virtual ~AudioDeviceFactory(); 53 virtual ~AudioDeviceFactory();
39 54
40 // You can derive from this class and specify an implementation for these 55 // You can derive from this class and specify an implementation for these
41 // functions to provide alternate audio device implementations. 56 // functions to provide alternate audio device implementations.
42 // If the return value of either of these function is NULL, we fall back 57 // If the return value of either of these function is NULL, we fall back
43 // on the default implementation. 58 // on the default implementation.
44 virtual media::AudioOutputDevice* CreateOutputDevice(int render_frame_id) = 0; 59 virtual media::AudioOutputDevice* CreateOutputDevice(
60 int render_frame_id,
61 int sesssion_id,
62 const std::string& device_id,
63 const url::Origin& security_origin) = 0;
45 virtual media::AudioInputDevice* CreateInputDevice(int render_frame_id) = 0; 64 virtual media::AudioInputDevice* CreateInputDevice(int render_frame_id) = 0;
46 65
47 private: 66 private:
48 // The current globally registered factory. This is NULL when we should 67 // The current globally registered factory. This is NULL when we should
49 // create the default AudioRendererSinks. 68 // create the default AudioRendererSinks.
50 static AudioDeviceFactory* factory_; 69 static AudioDeviceFactory* factory_;
51 70
52 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); 71 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory);
53 }; 72 };
54 73
55 } // namespace content 74 } // namespace content
56 75
57 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ 76 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698