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

Unified Diff: content/public/common/media_stream_request.h

Issue 23731007: Implicit audio output device selection for getUserMedia. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/media/media_stream_options.cc ('k') | content/public/common/media_stream_request.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/common/media_stream_request.h
diff --git a/content/public/common/media_stream_request.h b/content/public/common/media_stream_request.h
index cbbf232d1b31e74abc1731a346264096e7610de5..26fe9c1f8a59000ad9fab0b26b20b50115bca2a0 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;
« no previous file with comments | « content/common/media/media_stream_options.cc ('k') | content/public/common/media_stream_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698