| Index: content/browser/renderer_host/media/media_stream_manager.h
|
| diff --git a/content/browser/renderer_host/media/media_stream_manager.h b/content/browser/renderer_host/media/media_stream_manager.h
|
| index 4349a7046fefe5d176a0d2d11dd91d355e8700a6..2e8468f18f110d962c74a78c5c0ae5f022c110ad 100644
|
| --- a/content/browser/renderer_host/media/media_stream_manager.h
|
| +++ b/content/browser/renderer_host/media/media_stream_manager.h
|
| @@ -141,9 +141,6 @@ class CONTENT_EXPORT MediaStreamManager
|
| int capture_session_id) OVERRIDE;
|
| virtual void DevicesEnumerated(MediaStreamType stream_type,
|
| const StreamDeviceInfoArray& devices) OVERRIDE;
|
| - virtual void Error(MediaStreamType stream_type,
|
| - int capture_session_id,
|
| - MediaStreamProviderError error) OVERRIDE;
|
|
|
| // Implements base::SystemMonitor::DevicesChangedObserver.
|
| virtual void OnDevicesChanged(
|
| @@ -158,21 +155,20 @@ class CONTENT_EXPORT MediaStreamManager
|
| // generated stream (or when using --use-fake-ui-for-media-stream).
|
| void UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy> fake_ui);
|
|
|
| - // This object gets deleted on the UI thread after the IO thread has been
|
| - // destroyed. So we need to know when IO thread is being destroyed so that
|
| - // we can delete VideoCaptureManager and AudioInputDeviceManager.
|
| - // We also must call this function explicitly in tests which use
|
| - // TestBrowserThreadBundle, because the notification happens too late in that
|
| - // case (see http://crbug.com/247525#c14).
|
| - virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
|
| + // Used by test to find a StreamDeviceInfo that currently has been
|
| + // requested and match the input arguments. If such a StreamDeviceInfo is
|
| + // found it is copied to |device_info|.
|
| + bool FindRequestedDeviceInfo(const std::string& source_id,
|
| + int render_process_id,
|
| + int render_view_id,
|
| + MediaStreamRequestType type,
|
| + StreamDeviceInfo* device_info);
|
|
|
| protected:
|
| // Used for testing.
|
| MediaStreamManager();
|
|
|
| private:
|
| - friend class MockMediaStreamDispatcherHost;
|
| -
|
| // Contains all data needed to keep track of requests.
|
| class DeviceRequest;
|
|
|
| @@ -187,6 +183,11 @@ class CONTENT_EXPORT MediaStreamManager
|
|
|
| typedef std::map<std::string, DeviceRequest*> DeviceRequests;
|
|
|
| + // This object gets deleted on the UI thread after the IO thread has been
|
| + // destroyed. So we need to know when IO thread is being destroyed so that
|
| + // we can delete VideoCaptureManager and AudioInputDeviceManager.
|
| + virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
|
| +
|
| // Initializes the device managers on IO thread. Auto-starts the device
|
| // thread and registers this as a listener with the device managers.
|
| void InitializeDeviceManagersOnIOThread();
|
| @@ -196,16 +197,23 @@ class CONTENT_EXPORT MediaStreamManager
|
| void NotifyDevicesChanged(MediaStreamType stream_type,
|
| const StreamDeviceInfoArray& devices);
|
|
|
| -
|
| void HandleAccessRequestResponse(const std::string& label,
|
| const MediaStreamDevices& devices);
|
| void StopStreamFromUI(const std::string& label);
|
|
|
| + void DoCancelRequest(const std::string& label);
|
| +
|
| + void DoStopStreamDevice(int render_process_id,
|
| + int render_view_id,
|
| + const std::string& device_id);
|
| +
|
| + void DoEnumerateDevices(const std::string& label);
|
| +
|
| // Helpers.
|
| // Checks if all devices that was requested in the request identififed by
|
| // |label| has been opened and set the request state accordingly.
|
| void HandleRequestDone(const std::string& label,
|
| - DeviceRequest* request);
|
| + DeviceRequest* request);
|
| void StopDevice(const StreamDeviceInfo& device_info);
|
| // Returns true if a request for devices has been completed and the devices
|
| // has either been opened or an error has occurred.
|
| @@ -213,36 +221,47 @@ class CONTENT_EXPORT MediaStreamManager
|
| MediaStreamProvider* GetDeviceManager(MediaStreamType stream_type);
|
| void StartEnumeration(DeviceRequest* request);
|
| std::string AddRequest(DeviceRequest* request);
|
| - void RemoveRequest(DeviceRequests::iterator it);
|
| + void DeleteRequest(DeviceRequests::iterator it);
|
| void ClearEnumerationCache(EnumerationCache* cache);
|
| void PostRequestToUI(const std::string& label);
|
| void HandleRequest(const std::string& label);
|
| + bool SetupTabCaptureRequest(DeviceRequest* request);
|
| + bool SetupScreenCaptureRequest(DeviceRequest* request);
|
| // Returns true if a device with |device_id| has already been requested by
|
| // |render_process_id| and |render_view_id| of type |type|. If it has been
|
| - // requested, |device_info| contain information about the the device.
|
| + // requested, |device_info| contain information about the device.
|
| bool FindExistingRequestedDeviceInfo(int render_process_id,
|
| int render_view_id,
|
| + GURL security_origin,
|
| MediaStreamRequestType type,
|
| const std::string& device_id,
|
| + MediaStreamType device_type,
|
| StreamDeviceInfo* device_info,
|
| MediaRequestState* request_state) const;
|
|
|
| - // Sends cached device list to a client corresponding to the request
|
| - // identified by |label|.
|
| - void SendCachedDeviceList(EnumerationCache* cache, const std::string& label);
|
| + void FinalizeGenerateStream(const std::string& label,
|
| + DeviceRequest* request);
|
| + void FinalizeRequestFailed(const std::string& label);
|
| + void FinalizeOpenDevice(const std::string& label,
|
| + DeviceRequest* request);
|
| + void FinalizeMediaAccessRequest(const std::string& label,
|
| + const MediaStreamDevices& devices);
|
| + void FinalizeEnumerateDevices(const std::string& label,
|
| + DeviceRequest* request);
|
|
|
| // Helpers to start and stop monitoring devices.
|
| void StartMonitoring();
|
| void StopMonitoring();
|
|
|
| - // Finds and returns the raw device id corresponding to the given
|
| - // |device_guid|. Returns true if there was a raw device id that matched the
|
| - // given |device_guid|, false if nothing matched it.
|
| - bool TranslateGUIDToRawId(
|
| + bool TransLateRequestedSourceIdToDeviceId(MediaStreamRequest* request);
|
| + // Finds and returns the device id corresponding to the given
|
| + // |source_id|. Returns true if there was a raw device id that matched the
|
| + // given |source_id|, false if nothing matched it.
|
| + bool TranslateSourceIdToDeviceId(
|
| MediaStreamType stream_type,
|
| const GURL& security_origin,
|
| - const std::string& device_guid,
|
| - std::string* raw_device_id);
|
| + const std::string& source_id,
|
| + std::string* device_id);
|
|
|
| // Device thread shared by VideoCaptureManager and AudioInputDeviceManager.
|
| scoped_ptr<base::Thread> device_thread_;
|
|
|