diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-10 02:18:26 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-10 02:18:26 +0000 |
commit | 80c1b5a735a0a49d467980ec40fa74385f0479b0 (patch) | |
tree | caf75063c4d5b249c2b3ac886cd83ecf628d0d76 /content/public/common/media_stream_request.h | |
parent | 482fe239c2fe16c17e0b97833e53a72718e79671 (diff) | |
download | chromium_src-80c1b5a735a0a49d467980ec40fa74385f0479b0.zip chromium_src-80c1b5a735a0a49d467980ec40fa74385f0479b0.tar.gz chromium_src-80c1b5a735a0a49d467980ec40fa74385f0479b0.tar.bz2 |
Implicit audio output device selection for getUserMedia.
When a non-default input device is selected, do a best-effort selection of a matching output device.
This is used to switch output of media stream audio tracks to the output device that matches the currently open capture device (microphone).
An typical example is to support switching to USB headsets when in a audio/video call.
This does not affect the audio output of non-webrtc related audio elements and only happens when there's exactly 1 active audio capture device in the page.
BUG=276894
Review URL: https://chromiumcodereview.appspot.com/23731007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public/common/media_stream_request.h')
-rw-r--r-- | content/public/common/media_stream_request.h | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/content/public/common/media_stream_request.h b/content/public/common/media_stream_request.h index cbbf232..26fe9c1 100644 --- a/content/public/common/media_stream_request.h +++ b/content/public/common/media_stream_request.h @@ -71,7 +71,8 @@ struct CONTENT_EXPORT MediaStreamDevice { const std::string& id, const std::string& name, int sample_rate, - int channel_layout); + int channel_layout, + int frames_per_buffer); ~MediaStreamDevice(); @@ -81,20 +82,53 @@ struct CONTENT_EXPORT MediaStreamDevice { // The device's unique ID. std::string id; + // The device id of a matched output device if any (otherwise empty). + // Only applicable to audio devices. + std::string matched_output_device_id; + // The device's "friendly" name. Not guaranteed to be unique. std::string name; - // Preferred sample rate in samples per second for the device. - // Only utilized for audio devices. Will be set to 0 if the constructor - // with three parameters (intended for video) is used. - int sample_rate; - - // Preferred channel configuration for the device. - // Only utilized for audio devices. Will be set to 0 if the constructor - // with three parameters (intended for video) is used. - // TODO(henrika): ideally, we would like to use media::ChannelLayout here - // but including media/base/channel_layout.h violates checkdeps rules. - int channel_layout; + // Contains properties that match directly with those with the same name + // in media::AudioParameters. + struct AudioDeviceParameters { + AudioDeviceParameters() + : sample_rate(), channel_layout(), frames_per_buffer() { + } + + AudioDeviceParameters(int sample_rate, int channel_layout, + int frames_per_buffer) + : sample_rate(sample_rate), + channel_layout(channel_layout), + frames_per_buffer(frames_per_buffer) { + } + + // Preferred sample rate in samples per second for the device. + int sample_rate; + + // Preferred channel configuration for the device. + // TODO(henrika): ideally, we would like to use media::ChannelLayout here + // but including media/base/channel_layout.h violates checkdeps rules. + int channel_layout; + + // Preferred number of frames per buffer for the device. This is filled + // in on the browser side and can be used by the renderer to match the + // expected browser side settings and avoid unnecessary buffering. + // See media::AudioParameters for more. + int frames_per_buffer; + }; + + // These below two member variables are valid only when the type of device is + // audio (i.e. IsAudioMediaType returns true). + + // Contains the device properties of the capture device. + AudioDeviceParameters input; + + // If the capture device has an associated output device (e.g. headphones), + // this will contain the properties for the output device. If no such device + // exists (e.g. webcam w/mic), then the value of this member will be all + // zeros. + AudioDeviceParameters matched_output; }; typedef std::vector<MediaStreamDevice> MediaStreamDevices; |