Move MediaStream Mojo and public interfaces to Blink.

1389998
This commit is contained in:
deepak1556 2019-01-21 21:58:04 +05:30
parent 92cfc4a62d
commit a864167d46
8 changed files with 100 additions and 93 deletions

View file

@ -9,7 +9,8 @@
#include "base/memory/singleton.h"
#include "content/public/browser/media_observer.h"
#include "content/public/common/media_stream_request.h"
#include "content/public/browser/media_stream_request.h"
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
namespace atom {
@ -20,8 +21,8 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
static MediaCaptureDevicesDispatcher* GetInstance();
// Methods for observers. Called on UI thread.
const content::MediaStreamDevices& GetAudioCaptureDevices();
const content::MediaStreamDevices& GetVideoCaptureDevices();
const blink::MediaStreamDevices& GetAudioCaptureDevices();
const blink::MediaStreamDevices& GetVideoCaptureDevices();
// Helper to get the default devices which can be used by the media request.
// Uses the first available devices if the default devices are not available.
@ -30,19 +31,19 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
// Called on the UI thread.
void GetDefaultDevices(bool audio,
bool video,
content::MediaStreamDevices* devices);
blink::MediaStreamDevices* devices);
// Helpers for picking particular requested devices, identified by raw id.
// If the device requested is not available it will return NULL.
const content::MediaStreamDevice* GetRequestedAudioDevice(
const blink::MediaStreamDevice* GetRequestedAudioDevice(
const std::string& requested_audio_device_id);
const content::MediaStreamDevice* GetRequestedVideoDevice(
const blink::MediaStreamDevice* GetRequestedVideoDevice(
const std::string& requested_video_device_id);
// Returns the first available audio or video device, or NULL if no devices
// are available.
const content::MediaStreamDevice* GetFirstAvailableAudioDevice();
const content::MediaStreamDevice* GetFirstAvailableVideoDevice();
const blink::MediaStreamDevice* GetFirstAvailableAudioDevice();
const blink::MediaStreamDevice* GetFirstAvailableVideoDevice();
// Unittests that do not require actual device enumeration should call this
// API on the singleton. It is safe to call this multiple times on the
@ -56,14 +57,14 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
int render_view_id,
int page_request_id,
const GURL& security_origin,
content::MediaStreamType stream_type,
blink::MediaStreamType stream_type,
content::MediaRequestState state) override;
void OnCreatingAudioStream(int render_process_id,
int render_view_id) override;
void OnSetCapturingLinkSecured(int render_process_id,
int render_frame_id,
int page_request_id,
content::MediaStreamType stream_type,
blink::MediaStreamType stream_type,
bool is_secure) override;
private:
@ -72,6 +73,12 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
MediaCaptureDevicesDispatcher();
~MediaCaptureDevicesDispatcher() override;
// Only for testing, a list of cached audio capture devices.
blink::MediaStreamDevices test_audio_devices_;
// Only for testing, a list of cached video capture devices.
blink::MediaStreamDevices test_video_devices_;
// Flag used by unittests to disable device enumeration.
bool is_device_enumeration_disabled_;