@@ -115,27 +115,26 @@ const std::string& MediaStreamDevicesController::GetSecurityOriginSpec() const {
115
115
void MediaStreamDevicesController::Accept (bool update_content_setting) {
116
116
// Get the default devices for the request.
117
117
content::MediaStreamDevices devices;
118
+ MediaCaptureDevicesDispatcher* dispatcher =
119
+ MediaInternals::GetInstance ()->GetMediaCaptureDevicesDispatcher ();
118
120
switch (request_.request_type ) {
119
121
case content::MEDIA_OPEN_DEVICE: {
120
122
const content::MediaStreamDevice* device = NULL ;
121
123
// For open device request pick the desired device or fall back to the
122
124
// first available of the given type.
123
125
if (request_.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE) {
124
- device = MediaCaptureDevicesDispatcher::GetInstance () ->
126
+ device = dispatcher ->
125
127
GetRequestedAudioDevice (request_.requested_audio_device_id );
126
128
// TODO(wjia): Confirm this is the intended behavior.
127
129
if (!device) {
128
- device = MediaCaptureDevicesDispatcher::GetInstance ()->
129
- GetFirstAvailableAudioDevice ();
130
+ device = dispatcher->GetFirstAvailableAudioDevice ();
130
131
}
131
132
} else if (request_.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE) {
132
133
// Pepper API opens only one device at a time.
133
- device = MediaCaptureDevicesDispatcher::GetInstance ()->
134
- GetRequestedVideoDevice (request_.requested_video_device_id );
134
+ device = dispatcher->GetRequestedVideoDevice (request_.requested_video_device_id );
135
135
// TODO(wjia): Confirm this is the intended behavior.
136
136
if (!device) {
137
- device = MediaCaptureDevicesDispatcher::GetInstance ()->
138
- GetFirstAvailableVideoDevice ();
137
+ device = dispatcher->GetFirstAvailableVideoDevice ();
139
138
}
140
139
}
141
140
if (device)
@@ -148,17 +147,15 @@ void MediaStreamDevicesController::Accept(bool update_content_setting) {
148
147
// Get the exact audio or video device if an id is specified.
149
148
if (!request_.requested_audio_device_id .empty ()) {
150
149
const content::MediaStreamDevice* audio_device =
151
- MediaCaptureDevicesDispatcher::GetInstance ()->
152
- GetRequestedAudioDevice (request_.requested_audio_device_id );
150
+ dispatcher->GetRequestedAudioDevice (request_.requested_audio_device_id );
153
151
if (audio_device) {
154
152
devices.push_back (*audio_device);
155
153
needs_audio_device = false ;
156
154
}
157
155
}
158
156
if (!request_.requested_video_device_id .empty ()) {
159
157
const content::MediaStreamDevice* video_device =
160
- MediaCaptureDevicesDispatcher::GetInstance ()->
161
- GetRequestedVideoDevice (request_.requested_video_device_id );
158
+ dispatcher->GetRequestedVideoDevice (request_.requested_video_device_id );
162
159
if (video_device) {
163
160
devices.push_back (*video_device);
164
161
needs_video_device = false ;
0 commit comments