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

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.h

Issue 2291893002: Let Contraints Controll Mute/Unmute Audio Local Playback For Desktop Sharing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 2 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 // MediaStreamManager is used to open/enumerate media capture devices (video 5 // MediaStreamManager is used to open/enumerate media capture devices (video
6 // supported now). Call flow: 6 // supported now). Call flow:
7 // 1. GenerateStream is called when a render process wants to use a capture 7 // 1. GenerateStream is called when a render process wants to use a capture
8 // device. 8 // device.
9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to 9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to
10 // use devices and for which device to use. 10 // use devices and for which device to use.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 class CONTENT_EXPORT MediaStreamManager 71 class CONTENT_EXPORT MediaStreamManager
72 : public MediaStreamProviderListener, 72 : public MediaStreamProviderListener,
73 public base::MessageLoop::DestructionObserver, 73 public base::MessageLoop::DestructionObserver,
74 public base::PowerObserver { 74 public base::PowerObserver {
75 public: 75 public:
76 // Callback to deliver the result of a media request. 76 // Callback to deliver the result of a media request.
77 typedef base::Callback<void(const MediaStreamDevices& devices, 77 typedef base::Callback<void(const MediaStreamDevices& devices,
78 std::unique_ptr<MediaStreamUIProxy> ui)> 78 std::unique_ptr<MediaStreamUIProxy> ui)>
79 MediaRequestResponseCallback; 79 MediaRequestResponseCallback;
80 80
81 // Callback for testing.
82 typedef base::Callback<bool(const StreamControls&)>
83 GenerateStreamTestCallback;
84
81 // Adds |message| to native logs for outstanding device requests, for use by 85 // Adds |message| to native logs for outstanding device requests, for use by
82 // render processes hosts whose corresponding render processes are requesting 86 // render processes hosts whose corresponding render processes are requesting
83 // logging from webrtcLoggingPrivate API. Safe to call from any thread. 87 // logging from webrtcLoggingPrivate API. Safe to call from any thread.
84 static void SendMessageToNativeLog(const std::string& message); 88 static void SendMessageToNativeLog(const std::string& message);
85 89
86 explicit MediaStreamManager(media::AudioManager* audio_manager); 90 explicit MediaStreamManager(media::AudioManager* audio_manager);
87 91
88 ~MediaStreamManager() override; 92 ~MediaStreamManager() override;
89 93
90 // Used to access VideoCaptureManager. 94 // Used to access VideoCaptureManager.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // This method is called when an audio or video device is removed. It makes 271 // This method is called when an audio or video device is removed. It makes
268 // sure all MediaStreams that use a removed device are stopped and that the 272 // sure all MediaStreams that use a removed device are stopped and that the
269 // render process is notified. 273 // render process is notified.
270 void StopRemovedDevice(MediaDeviceType type, const MediaDeviceInfo& device); 274 void StopRemovedDevice(MediaDeviceType type, const MediaDeviceInfo& device);
271 275
272 // TODO(guidou): Remove this function once handling for renderer requests for 276 // TODO(guidou): Remove this function once handling for renderer requests for
273 // device-event notifications is moved out of MediaStreamDispatcherHost. 277 // device-event notifications is moved out of MediaStreamDispatcherHost.
274 // See http://crbug.com/648183. 278 // See http://crbug.com/648183.
275 void NotifyDeviceChangeSubscribers(MediaStreamType type); 279 void NotifyDeviceChangeSubscribers(MediaStreamType type);
276 280
281 void SetGenerateStreamCallbackForTesting(
282 GenerateStreamTestCallback test_callback);
283
277 private: 284 private:
278 // Contains all data needed to keep track of requests. 285 // Contains all data needed to keep track of requests.
279 class DeviceRequest; 286 class DeviceRequest;
280 287
281 // |DeviceRequests| is a list to ensure requests are processed in the order 288 // |DeviceRequests| is a list to ensure requests are processed in the order
282 // they arrive. The first member of the pair is the label of the 289 // they arrive. The first member of the pair is the label of the
283 // |DeviceRequest|. 290 // |DeviceRequest|.
284 using LabeledDeviceRequest = std::pair<std::string, DeviceRequest*>; 291 using LabeledDeviceRequest = std::pair<std::string, DeviceRequest*>;
285 using DeviceRequests = std::list<LabeledDeviceRequest>; 292 using DeviceRequests = std::list<LabeledDeviceRequest>;
286 293
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 450
444 bool use_fake_ui_; 451 bool use_fake_ui_;
445 std::unique_ptr<FakeMediaStreamUIProxy> fake_ui_; 452 std::unique_ptr<FakeMediaStreamUIProxy> fake_ui_;
446 453
447 // Maps render process hosts to log callbacks. Used on the IO thread. 454 // Maps render process hosts to log callbacks. Used on the IO thread.
448 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_; 455 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_;
449 456
450 // Objects subscribed to changes in the set of media devices. 457 // Objects subscribed to changes in the set of media devices.
451 std::vector<MediaStreamRequester*> device_change_subscribers_; 458 std::vector<MediaStreamRequester*> device_change_subscribers_;
452 459
460 GenerateStreamTestCallback generate_stream_test_callback_;
461
453 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 462 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
454 }; 463 };
455 464
456 } // namespace content 465 } // namespace content
457 466
458 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 467 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698