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

Side by Side Diff: content/renderer/media/mock_media_stream_dispatcher.cc

Issue 2696443002: Reland of Use spec-compliant algorithm to select video devices in getUserMedia. (Closed)
Patch Set: Address boliu's comments Created 3 years, 10 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 #include "content/renderer/media/mock_media_stream_dispatcher.h" 5 #include "content/renderer/media/mock_media_stream_dispatcher.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "content/public/common/media_stream_request.h" 8 #include "content/public/common/media_stream_request.h"
9 #include "media/base/audio_parameters.h" 9 #include "media/base/audio_parameters.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 12 matching lines...) Expand all
23 stop_video_device_counter_(0), 23 stop_video_device_counter_(0),
24 session_id_(0), 24 session_id_(0),
25 test_same_id_(false) {} 25 test_same_id_(false) {}
26 26
27 MockMediaStreamDispatcher::~MockMediaStreamDispatcher() {} 27 MockMediaStreamDispatcher::~MockMediaStreamDispatcher() {}
28 28
29 void MockMediaStreamDispatcher::GenerateStream( 29 void MockMediaStreamDispatcher::GenerateStream(
30 int request_id, 30 int request_id,
31 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, 31 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler,
32 const StreamControls& controls, 32 const StreamControls& controls,
33 const url::Origin& url) { 33 const url::Origin& security_origin,
34 bool is_processing_user_gesture) {
34 // Audio and video share the same request so we use |audio_input_request_id_| 35 // Audio and video share the same request so we use |audio_input_request_id_|
35 // only. 36 // only.
36 audio_input_request_id_ = request_id; 37 audio_input_request_id_ = request_id;
37 38
38 stream_label_ = "local_stream" + base::IntToString(request_id); 39 stream_label_ = "local_stream" + base::IntToString(request_id);
39 audio_input_array_.clear(); 40 audio_input_array_.clear();
40 video_array_.clear(); 41 video_array_.clear();
41 42
42 if (controls.audio.requested) { 43 if (controls.audio.requested) {
43 AddAudioInputDeviceToArray(false, controls.audio.device_id); 44 AddAudioInputDeviceToArray(false, controls.audio.device_id);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 video.device.name = "usb video camera"; 111 video.device.name = "usb video camera";
111 video.device.type = MEDIA_DEVICE_VIDEO_CAPTURE; 112 video.device.type = MEDIA_DEVICE_VIDEO_CAPTURE;
112 video.device.video_facing = facing_user 113 video.device.video_facing = facing_user
113 ? media::MEDIA_VIDEO_FACING_USER 114 ? media::MEDIA_VIDEO_FACING_USER
114 : media::MEDIA_VIDEO_FACING_ENVIRONMENT; 115 : media::MEDIA_VIDEO_FACING_ENVIRONMENT;
115 video.session_id = session_id_; 116 video.session_id = session_id_;
116 video_array_.push_back(video); 117 video_array_.push_back(video);
117 } 118 }
118 119
119 } // namespace content 120 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/mock_media_stream_dispatcher.h ('k') | content/renderer/media/user_media_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698