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

Side by Side 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 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_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ 5 #ifndef CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_
6 #define CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ 6 #define CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 MediaStreamDevice( 64 MediaStreamDevice(
65 MediaStreamType type, 65 MediaStreamType type,
66 const std::string& id, 66 const std::string& id,
67 const std::string& name); 67 const std::string& name);
68 68
69 MediaStreamDevice( 69 MediaStreamDevice(
70 MediaStreamType type, 70 MediaStreamType type,
71 const std::string& id, 71 const std::string& id,
72 const std::string& name, 72 const std::string& name,
73 int sample_rate, 73 int sample_rate,
74 int channel_layout); 74 int channel_layout,
75 int frames_per_buffer);
75 76
76 ~MediaStreamDevice(); 77 ~MediaStreamDevice();
77 78
78 // The device's type. 79 // The device's type.
79 MediaStreamType type; 80 MediaStreamType type;
80 81
81 // The device's unique ID. 82 // The device's unique ID.
82 std::string id; 83 std::string id;
83 84
85 // The device id of a matched output device if any (otherwise empty).
86 // Only applicable to audio devices.
87 std::string matched_output_device_id;
88
84 // The device's "friendly" name. Not guaranteed to be unique. 89 // The device's "friendly" name. Not guaranteed to be unique.
85 std::string name; 90 std::string name;
86 91
87 // Preferred sample rate in samples per second for the device. 92 // Contains properties that match directly with those with the same name
88 // Only utilized for audio devices. Will be set to 0 if the constructor 93 // in media::AudioParameters.
89 // with three parameters (intended for video) is used. 94 struct AudioDeviceParameters {
90 int sample_rate; 95 AudioDeviceParameters()
96 : sample_rate(), channel_layout(), frames_per_buffer() {
97 }
91 98
92 // Preferred channel configuration for the device. 99 AudioDeviceParameters(int sample_rate, int channel_layout,
93 // Only utilized for audio devices. Will be set to 0 if the constructor 100 int frames_per_buffer)
94 // with three parameters (intended for video) is used. 101 : sample_rate(sample_rate),
95 // TODO(henrika): ideally, we would like to use media::ChannelLayout here 102 channel_layout(channel_layout),
96 // but including media/base/channel_layout.h violates checkdeps rules. 103 frames_per_buffer(frames_per_buffer) {
97 int channel_layout; 104 }
105
106 // Preferred sample rate in samples per second for the device.
107 int sample_rate;
108
109 // Preferred channel configuration for the device.
110 // TODO(henrika): ideally, we would like to use media::ChannelLayout here
111 // but including media/base/channel_layout.h violates checkdeps rules.
112 int channel_layout;
113
114 // Preferred number of frames per buffer for the device. This is filled
115 // in on the browser side and can be used by the renderer to match the
116 // expected browser side settings and avoid unnecessary buffering.
117 // See media::AudioParameters for more.
118 int frames_per_buffer;
119 };
120
121 // These below two member variables are valid only when the type of device is
122 // audio (i.e. IsAudioMediaType returns true).
123
124 // Contains the device properties of the capture device.
125 AudioDeviceParameters input;
126
127 // If the capture device has an associated output device (e.g. headphones),
128 // this will contain the properties for the output device. If no such device
129 // exists (e.g. webcam w/mic), then the value of this member will be all
130 // zeros.
131 AudioDeviceParameters matched_output;
98 }; 132 };
99 133
100 typedef std::vector<MediaStreamDevice> MediaStreamDevices; 134 typedef std::vector<MediaStreamDevice> MediaStreamDevices;
101 135
102 typedef std::map<MediaStreamType, MediaStreamDevices> MediaStreamDeviceMap; 136 typedef std::map<MediaStreamType, MediaStreamDevices> MediaStreamDeviceMap;
103 137
104 // Represents a request for media streams (audio/video). 138 // Represents a request for media streams (audio/video).
105 // It looks like the last 4 parameters should use StreamOptions instead, but 139 // It looks like the last 4 parameters should use StreamOptions instead, but
106 // StreamOption depends on media_stream_request.h because it needs 140 // StreamOption depends on media_stream_request.h because it needs
107 // MediaStreamDevice. 141 // MediaStreamDevice.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 }; 206 };
173 207
174 // Callback used return results of media access requests. 208 // Callback used return results of media access requests.
175 typedef base::Callback<void( 209 typedef base::Callback<void(
176 const MediaStreamDevices& devices, 210 const MediaStreamDevices& devices,
177 scoped_ptr<MediaStreamUI> ui)> MediaResponseCallback; 211 scoped_ptr<MediaStreamUI> ui)> MediaResponseCallback;
178 212
179 } // namespace content 213 } // namespace content
180 214
181 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ 215 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_
OLDNEW
« 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