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

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: Nit 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 class CONTENT_EXPORT MediaStreamManager 72 class CONTENT_EXPORT MediaStreamManager
73 : public MediaStreamProviderListener, 73 : public MediaStreamProviderListener,
74 public base::MessageLoop::DestructionObserver, 74 public base::MessageLoop::DestructionObserver,
75 public base::PowerObserver { 75 public base::PowerObserver {
76 public: 76 public:
77 // Callback to deliver the result of a media request. 77 // Callback to deliver the result of a media request.
78 typedef base::Callback<void(const MediaStreamDevices& devices, 78 typedef base::Callback<void(const MediaStreamDevices& devices,
79 std::unique_ptr<MediaStreamUIProxy> ui)> 79 std::unique_ptr<MediaStreamUIProxy> ui)>
80 MediaRequestResponseCallback; 80 MediaRequestResponseCallback;
81 81
82 // Callback for testing.
83 typedef base::Callback<bool(const StreamControls&)>
84 GenerateStreamTestCallback;
85
82 // Adds |message| to native logs for outstanding device requests, for use by 86 // Adds |message| to native logs for outstanding device requests, for use by
83 // render processes hosts whose corresponding render processes are requesting 87 // render processes hosts whose corresponding render processes are requesting
84 // logging from webrtcLoggingPrivate API. Safe to call from any thread. 88 // logging from webrtcLoggingPrivate API. Safe to call from any thread.
85 static void SendMessageToNativeLog(const std::string& message); 89 static void SendMessageToNativeLog(const std::string& message);
86 90
87 explicit MediaStreamManager(media::AudioManager* audio_manager); 91 explicit MediaStreamManager(media::AudioManager* audio_manager);
88 92
89 ~MediaStreamManager() override; 93 ~MediaStreamManager() override;
90 94
91 // Used to access VideoCaptureManager. 95 // Used to access VideoCaptureManager.
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // This method is called when an audio or video device is removed. It makes 277 // This method is called when an audio or video device is removed. It makes
274 // sure all MediaStreams that use a removed device are stopped and that the 278 // sure all MediaStreams that use a removed device are stopped and that the
275 // render process is notified. 279 // render process is notified.
276 void StopRemovedDevice(MediaDeviceType type, const MediaDeviceInfo& device); 280 void StopRemovedDevice(MediaDeviceType type, const MediaDeviceInfo& device);
277 281
278 // TODO(guidou): Remove this function once handling for renderer requests for 282 // TODO(guidou): Remove this function once handling for renderer requests for
279 // device-event notifications is moved out of MediaStreamDispatcherHost. 283 // device-event notifications is moved out of MediaStreamDispatcherHost.
280 // See http://crbug.com/648183. 284 // See http://crbug.com/648183.
281 void NotifyDeviceChangeSubscribers(MediaStreamType type); 285 void NotifyDeviceChangeSubscribers(MediaStreamType type);
282 286
287 void SetGenerateStreamCallbackForTesting(
288 GenerateStreamTestCallback test_callback);
289
283 private: 290 private:
284 // Contains all data needed to keep track of requests. 291 // Contains all data needed to keep track of requests.
285 class DeviceRequest; 292 class DeviceRequest;
286 293
287 // |DeviceRequests| is a list to ensure requests are processed in the order 294 // |DeviceRequests| is a list to ensure requests are processed in the order
288 // they arrive. The first member of the pair is the label of the 295 // they arrive. The first member of the pair is the label of the
289 // |DeviceRequest|. 296 // |DeviceRequest|.
290 using LabeledDeviceRequest = std::pair<std::string, DeviceRequest*>; 297 using LabeledDeviceRequest = std::pair<std::string, DeviceRequest*>;
291 using DeviceRequests = std::list<LabeledDeviceRequest>; 298 using DeviceRequests = std::list<LabeledDeviceRequest>;
292 299
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 457
451 bool use_fake_ui_; 458 bool use_fake_ui_;
452 std::unique_ptr<FakeMediaStreamUIProxy> fake_ui_; 459 std::unique_ptr<FakeMediaStreamUIProxy> fake_ui_;
453 460
454 // Maps render process hosts to log callbacks. Used on the IO thread. 461 // Maps render process hosts to log callbacks. Used on the IO thread.
455 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_; 462 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_;
456 463
457 // Objects subscribed to changes in the set of media devices. 464 // Objects subscribed to changes in the set of media devices.
458 std::vector<MediaStreamRequester*> device_change_subscribers_; 465 std::vector<MediaStreamRequester*> device_change_subscribers_;
459 466
467 GenerateStreamTestCallback generate_stream_test_callback_;
468
460 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 469 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
461 }; 470 };
462 471
463 } // namespace content 472 } // namespace content
464 473
465 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 474 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698