chromium/content/browser/renderer_host/media/media_stream_manager.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/renderer_host/media/media_stream_manager.h"

#include <stddef.h>
#include <stdint.h>

#include <list>
#include <memory>
#include <optional>
#include <vector>

#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/not_fatal_until.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread.h"
#include "base/uuid.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/media/capture/desktop_capture_device_uma_types.h"
#include "content/browser/media/media_devices_permission_checker.h"
#include "content/browser/media/media_devices_util.h"
#include "content/browser/permissions/permission_controller_impl.h"
#include "content/browser/renderer_host/media/audio_input_device_manager.h"
#include "content/browser/renderer_host/media/audio_service_listener.h"
#include "content/browser/renderer_host/media/in_process_video_capture_provider.h"
#include "content/browser/renderer_host/media/media_capture_devices_impl.h"
#include "content/browser/renderer_host/media/media_devices_manager.h"
#include "content/browser/renderer_host/media/media_stream_metrics.h"
#include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
#include "content/browser/renderer_host/media/service_video_capture_provider.h"
#include "content/browser/renderer_host/media/video_capture_manager.h"
#include "content/browser/renderer_host/media/video_capture_provider_switcher.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/desktop_streams_registry.h"
#include "content/public/browser/media_observer.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents_media_capture_id.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "crypto/hmac.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_system.h"
#include "media/base/audio_parameters.h"
#include "media/base/channel_layout.h"
#include "media/base/media_switches.h"
#include "media/capture/content/screen_enumerator.h"
#include "media/capture/video/create_video_capture_device_factory.h"
#include "media/capture/video/fake_video_capture_device.h"
#include "media/capture/video/fake_video_capture_device_factory.h"
#include "media/capture/video/video_capture_system_impl.h"
#include "media/mojo/mojom/display_media_information.mojom.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/mediastream/media_devices.h"
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"

#if BUILDFLAG(IS_WIN)
#include "base/win/scoped_com_initializer.h"
#endif

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chromeos/ash/components/audio/cras_audio_handler.h"
#include "content/browser/gpu/chromeos/video_capture_dependencies.h"
#include "content/browser/gpu/gpu_memory_buffer_manager_singleton.h"
#include "content/public/browser/chromeos/multi_capture_service.h"
#include "media/capture/video/chromeos/camera_hal_dispatcher_impl.h"
#include "media/capture/video/chromeos/jpeg_accelerator_provider.h"
#include "media/capture/video/chromeos/public/cros_features.h"
#include "media/capture/video/chromeos/system_event_monitor_impl.h"
#include "media/capture/video/chromeos/video_capture_device_factory_chromeos.h"
#endif

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/lacros/lacros_service.h"
#endif

#if !BUILDFLAG(IS_ANDROID)
#include "content/browser/media/captured_surface_controller.h"
#endif

MediaDeviceType;

namespace content {

ABSL_CONST_INIT thread_local MediaStreamManager* media_stream_manager =;

MediaStreamDevice;
MediaStreamDevices;
MediaStreamRequestType;
StreamControls;
TrackControls;
CapturedSurfaceControlResult;
GetOpenDeviceResponse;
MediaStreamRequestResult;
MediaStreamType;
StreamSelectionInfo;
StreamSelectionInfoPtr;

namespace {
// Turns off available audio effects (removes the flag) if the options
// explicitly turn them off.
void FilterAudioEffects(const StreamControls& controls, int* effects) {}

// Unlike other effects, hotword is off by default, so turn it on if it's
// requested and available.
void EnableHotwordEffect(const StreamControls& controls, int* effects) {}

// Gets raw |device_id| and |group_id| when given a hashed device_id
// |hmac_device_id|. Both |device_id| and |group_id| could be null pointers.
bool GetDeviceIDAndGroupIDFromHMAC(
    const MediaDeviceSaltAndOrigin& salt_and_origin,
    const std::string& hmac_device_id,
    const blink::WebMediaDeviceInfoArray& devices,
    std::string* device_id,
    std::optional<std::string>* group_id) {}

MediaStreamType ConvertToMediaStreamType(MediaDeviceType type) {}

const char* DeviceTypeToString(MediaDeviceType type) {}

const char* RequestTypeToString(blink::MediaStreamRequestType type) {}

const char* StreamTypeToString(blink::mojom::MediaStreamType type) {}

const char* RequestStateToString(MediaRequestState state) {}

const char* RequestResultToString(
    blink::mojom::MediaStreamRequestResult result) {}

std::string GetGenerateStreamsLogString(
    GlobalRenderFrameHostId render_frame_host_id,
    int requester_id,
    int page_request_id) {}

std::string GetOpenDeviceLogString(GlobalRenderFrameHostId render_frame_host_id,
                                   int requester_id,
                                   int page_request_id,
                                   const std::string& device_id,
                                   MediaStreamType type) {}

std::string GetStopStreamDeviceLogString(
    GlobalRenderFrameHostId render_frame_host_id,
    int requester_id,
    const std::string& device_id,
    const base::UnguessableToken& session_id) {}

void SendLogMessage(const std::string& message) {}

void SendVideoCaptureLogMessage(const std::string& message) {}

// Returns MediaStreamDevices for getDisplayMedia() calls.
// Returns a video device built with DesktopMediaID with fake initializers if
// |kUseFakeDeviceForMediaStream| is set and |preferred_display_surface| is no
// preference. If |exclude_monitor_type_surfaces| is true, returns tab
// DesktopMediaID. Otherwise, if |preferred_display_surface| specifies a screen,
// window, or tab, returns a video device with matching DesktopMediaID
// Returns a video device with default DesktopMediaID otherwise.
// Returns an audio device with default device parameters.
// If |kUseFakeDeviceForMediaStream| specifies a
// browser window, use |render_process_id| and |render_frame_id| as the browser
// window identifier.
//
// When the result of the configuration results in tab-capture,
// if `captured_tab_id` is non-null, it represents the tab that
// will be captured. Otherwise, the capturer ends up capturing
// their own tab.
//
// TODO(crbug.com/41485487): Refactor this function.
MediaStreamDevices DisplayMediaDevicesFromFakeDeviceConfig(
    blink::mojom::MediaStreamType media_type,
    bool request_audio,
    GlobalRenderFrameHostId render_frame_host_id,
    blink::mojom::PreferredDisplaySurface preferred_display_surface,
    bool exclude_monitor_type_surfaces,
    std::optional<WebContentsMediaCaptureId> captured_tab_id) {}

bool ChangeSourceSupported(const MediaStreamDevices& devices) {}

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
base::TimeDelta GetConditionalFocusWindow() {}

MediaStreamManager::CapturedSurfaceControllerFactoryCallback
MakeDefaultCapturedSurfaceControllerFactory() {}
#endif

const blink::MediaStreamDevice* GetStreamDevice(
    const blink::mojom::StreamDevices& stream_devices,
    const base::UnguessableToken& session_id) {}

}  // namespace

// MediaStreamManager::DeviceRequest represents a request to either enumerate
// available devices or open one or more devices.
// TODO(perkj): MediaStreamManager still needs refactoring. I propose we create
// several subclasses of DeviceRequest and move some of the responsibility of
// the MediaStreamManager to the subclasses to get rid of the way too many if
// statements in MediaStreamManager.
class MediaStreamManager::DeviceRequest {};

class MediaStreamManager::MediaAccessRequest
    : public MediaStreamManager::DeviceRequest {};

class MediaStreamManager::CreateDeviceRequest
    : public MediaStreamManager::DeviceRequest {};

class MediaStreamManager::GenerateStreamsRequest
    : public MediaStreamManager::CreateDeviceRequest {};

class MediaStreamManager::GetOpenDeviceRequest
    : public MediaStreamManager::CreateDeviceRequest {};

class MediaStreamManager::OpenDeviceRequest
    : public MediaStreamManager::DeviceRequest {};

// static
void MediaStreamManager::SendMessageToNativeLog(const std::string& message) {}

// static
MediaStreamManager* MediaStreamManager::GetInstance() {}

MediaStreamManager::MediaStreamManager(media::AudioSystem* audio_system)
    :{}

MediaStreamManager::MediaStreamManager(
    media::AudioSystem* audio_system,
    std::unique_ptr<VideoCaptureProvider> video_capture_provider)
    :{}

MediaStreamManager::~MediaStreamManager() {}

VideoCaptureManager* MediaStreamManager::video_capture_manager() const {}

AudioInputDeviceManager* MediaStreamManager::audio_input_device_manager()
    const {}

AudioServiceListener* MediaStreamManager::audio_service_listener() {}

MediaDevicesManager* MediaStreamManager::media_devices_manager() {}

media::AudioSystem* MediaStreamManager::audio_system() {}

void MediaStreamManager::AddVideoCaptureObserver(
    media::VideoCaptureObserver* capture_observer) {}

void MediaStreamManager::RemoveAllVideoCaptureObservers() {}

std::string MediaStreamManager::MakeMediaAccessRequest(
    GlobalRenderFrameHostId render_frame_host_id,
    int requester_id,
    int page_request_id,
    const StreamControls& controls,
    const url::Origin& security_origin,
    MediaAccessRequestCallback callback) {}

void MediaStreamManager::GenerateStreams(
    GlobalRenderFrameHostId render_frame_host_id,
    int requester_id,
    int page_request_id,
    const StreamControls& controls,
    MediaDeviceSaltAndOrigin salt_and_origin,
    bool user_gesture,
    StreamSelectionInfoPtr audio_stream_selection_info_ptr,
    GenerateStreamsCallback generate_streams_callback,
    DeviceStoppedCallback device_stopped_callback,
    DeviceChangedCallback device_changed_callback,
    DeviceRequestStateChangeCallback device_request_state_change_callback,
    DeviceCaptureConfigurationChangeCallback
        device_capture_configuration_change_callback,
    DeviceCaptureHandleChangeCallback device_capture_handle_change_callback,
    ZoomLevelChangeCallback zoom_level_change_callback) {}

void MediaStreamManager::GetOpenDevice(
    const base::UnguessableToken& device_session_id,
    const base::UnguessableToken& transfer_id,
    GlobalRenderFrameHostId render_frame_host_id,
    int requester_id,
    int page_request_id,
    MediaDeviceSaltAndOrigin salt_and_origin,
    GetOpenDeviceCallback get_open_device_callback,
    DeviceStoppedCallback device_stopped_callback,
    DeviceChangedCallback device_changed_callback,
    DeviceRequestStateChangeCallback device_request_state_change_callback,
    DeviceCaptureConfigurationChangeCallback
        device_capture_configuration_change_callback,
    DeviceCaptureHandleChangeCallback device_capture_handle_change_callback,
    ZoomLevelChangeCallback zoom_level_change_callback) {}

void MediaStreamManager::CancelRequest(
    GlobalRenderFrameHostId render_frame_host_id,
    int requester_id,
    int page_request_id) {}

void MediaStreamManager::CancelRequest(const std::string& label) {}

void MediaStreamManager::CancelAllRequests(
    GlobalRenderFrameHostId render_frame_host_id,
    int requester_id) {}

void MediaStreamManager::StopStreamDevice(
    GlobalRenderFrameHostId render_frame_host_id,
    int requester_id,
    const std::string& device_id,
    const base::UnguessableToken& session_id) {}

bool MediaStreamManager::KeepDeviceAliveForTransfer(
    GlobalRenderFrameHostId render_frame_host_id,
    int requester_id,
    const base::UnguessableToken& session_id,
    const base::UnguessableToken& transfer_id) {}

base::UnguessableToken MediaStreamManager::VideoDeviceIdToSessionId(
    const std::string& device_id) const {}

void MediaStreamManager::StopDevice(MediaStreamType type,
                                    const base::UnguessableToken& session_id) {}

void MediaStreamManager::CloseDevice(MediaStreamType type,
                                     const base::UnguessableToken& session_id) {}

void MediaStreamManager::OpenDevice(
    GlobalRenderFrameHostId render_frame_host_id,
    int requester_id,
    int page_request_id,
    const std::string& device_id,
    MediaStreamType type,
    MediaDeviceSaltAndOrigin salt_and_origin,
    OpenDeviceCallback open_device_callback,
    DeviceStoppedCallback device_stopped_callback) {}

void MediaStreamManager::EnsureDeviceMonitorStarted() {}

void MediaStreamManager::StopRemovedDevice(
    MediaDeviceType type,
    const blink::WebMediaDeviceInfo& media_device_info) {}

bool MediaStreamManager::RemoveInvalidDeviceIds(
    const MediaDeviceSaltAndOrigin& salt_and_origin,
    const TrackControls& controls,
    const blink::WebMediaDeviceInfoArray& devices,
    std::vector<std::string>* device_ids) const {}

bool MediaStreamManager::GetEligibleCaptureDeviceids(
    const DeviceRequest* request,
    MediaStreamType type,
    const blink::WebMediaDeviceInfoArray& devices,
    std::vector<std::string>* device_ids) const {}

void MediaStreamManager::TranslateDeviceIdToSourceId(
    const DeviceRequest* request,
    MediaStreamDevice* device) const {}

void MediaStreamManager::StartEnumeration(DeviceRequest* request,
                                          const std::string& label) {}

MediaStreamManager::DeviceRequests::const_iterator
MediaStreamManager::AddRequest(std::unique_ptr<DeviceRequest> request) {}

MediaStreamManager::DeviceRequests::const_iterator
MediaStreamManager::FindRequestIterator(const std::string& label) const {}

MediaStreamManager::DeviceRequest* MediaStreamManager::FindRequest(
    const std::string& label) const {}

MediaStreamManager::DeviceRequest*
MediaStreamManager::FindRequestByVideoSessionId(
    const base::UnguessableToken& session_id) const {}

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)

CapturedSurfaceController* MediaStreamManager::GetCapturedSurfaceController(
    GlobalRenderFrameHostId capturer_rfh_id,
    const base::UnguessableToken& session_id,
    blink::mojom::CapturedSurfaceControlResult& result) {}
#endif

std::optional<MediaStreamDevice> MediaStreamManager::CloneExistingOpenDevice(
    const base::UnguessableToken& existing_device_session_id,
    const base::UnguessableToken& transfer_id,
    const std::string& new_label) {}

void MediaStreamManager::UpdateDeviceTransferStatus(
    DeviceRequest* request,
    const blink::MediaStreamDevice* const device,
    const base::UnguessableToken& transfer_id,
    TransferState transfer_state) {}

void MediaStreamManager::CancelRequest(
    DeviceRequests::const_iterator request_it) {}

void MediaStreamManager::DeleteRequest(
    DeviceRequests::const_iterator request_it) {}

void MediaStreamManager::ReadOutputParamsAndPostRequestToUI(
    const std::string& label,
    DeviceRequest* request,
    const MediaDeviceEnumeration& enumeration) {}

void MediaStreamManager::PostRequestToUI(
    const std::string& label,
    const MediaDeviceEnumeration& enumeration,
    const std::optional<media::AudioParameters>& output_parameters) {}

void MediaStreamManager::SetUpRequest(const std::string& label) {}

bool MediaStreamManager::SetUpDisplayCaptureRequest(DeviceRequest* request) {}

bool MediaStreamManager::SetUpDeviceCaptureRequest(
    DeviceRequest* request,
    const MediaDeviceEnumeration& enumeration) {}

bool MediaStreamManager::SetUpTabCaptureRequest(DeviceRequest* request,
                                                const std::string& label) {}

DesktopMediaID MediaStreamManager::ResolveTabCaptureDeviceIdOnUIThread(
    const std::string& capture_device_id,

    GlobalRenderFrameHostId requesting_render_frame_host_id,
    const GURL& origin) {}

void MediaStreamManager::FinishTabCaptureRequestSetupWithDeviceId(
    const std::string& label,
    const DesktopMediaID& device_id) {}

bool MediaStreamManager::SetUpScreenCaptureRequest(DeviceRequest* request) {}

void MediaStreamManager::SetUpDesktopCaptureChangeSourceRequest(
    DeviceRequest* request,
    const std::string& label,
    const DesktopMediaID& media_id) {}

MediaStreamDevices MediaStreamManager::GetDevicesOpenedByRequest(
    const std::string& label) const {}

void MediaStreamManager::GetRawDeviceIdsOpenedForFrame(
    RenderFrameHost* render_frame_host,
    blink::mojom::MediaStreamType type,
    GetRawDeviceIdsOpenedForFrameCallback callback) const {}

void MediaStreamManager::GetRawDeviceIdsOpenedForFrameIds(
    blink::mojom::MediaStreamType type,
    GetRawDeviceIdsOpenedForFrameCallback callback,
    base::flat_set<GlobalRenderFrameHostId> render_frame_host_ids) const {}

bool MediaStreamManager::FindExistingRequestedDevice(
    const DeviceRequest& new_request,
    const MediaStreamDevice& new_device,
    MediaStreamDevice* existing_device,
    MediaRequestState* existing_request_state) const {}

void MediaStreamManager::FinalizeGenerateStreams(const std::string& label,
                                                 DeviceRequest* request) {}

void MediaStreamManager::FinalizeGetOpenDevice(const std::string& label,
                                               DeviceRequest* request) {}

// TODO(crbug.com/40058526): Ensure CaptureHandle works for transferred
// MediaStreamTracks and add tests for the same.
// TODO(crbug.com/40832991): Ensure track transfer does not initiate
// focus-change with Conditional focus enabled.
void MediaStreamManager::PanTiltZoomPermissionChecked(
    const std::string& label,
    const std::optional<MediaStreamDevice>& video_device,
    bool pan_tilt_zoom_allowed) {}

void MediaStreamManager::FinalizeRequestFailed(
    DeviceRequests::const_iterator request_it,
    MediaStreamRequestResult result) {}

void MediaStreamManager::FinalizeChangeDevice(const std::string& label,
                                              DeviceRequest* request) {}

void MediaStreamManager::FinalizeMediaAccessRequest(
    DeviceRequests::const_iterator request_it,
    const blink::mojom::StreamDevicesSet& stream_devices_set) {}

void MediaStreamManager::SetRequestDevice(
    blink::mojom::StreamDevices& target_devices,
    const blink::MediaStreamDevice& device) {}

void MediaStreamManager::InitializeMaybeAsync(
    std::unique_ptr<VideoCaptureProvider> video_capture_provider) {}

void MediaStreamManager::Opened(
    MediaStreamType stream_type,
    const base::UnguessableToken& capture_session_id) {}

void MediaStreamManager::HandleRequestDone(const std::string& label,
                                           DeviceRequest* request) {}

void MediaStreamManager::Closed(
    MediaStreamType stream_type,
    const base::UnguessableToken& capture_session_id) {}

void MediaStreamManager::DevicesEnumerated(
    bool requested_audio_input,
    bool requested_video_input,
    const std::string& label,
    const MediaDeviceEnumeration& enumeration) {}

void MediaStreamManager::Aborted(
    MediaStreamType stream_type,
    const base::UnguessableToken& capture_session_id) {}

void MediaStreamManager::UseFakeUIFactoryForTests(
    base::RepeatingCallback<std::unique_ptr<FakeMediaStreamUIProxy>(void)>
        fake_ui_factory,
    bool use_for_gum_desktop_capture,
    std::optional<WebContentsMediaCaptureId> captured_tab_id) {}

// static
void MediaStreamManager::RegisterNativeLogCallback(
    int renderer_host_id,
    base::RepeatingCallback<void(const std::string&)> callback) {}

// static
void MediaStreamManager::UnregisterNativeLogCallback(int renderer_host_id) {}

void MediaStreamManager::AddLogMessageOnIOThread(const std::string& message) {}

void MediaStreamManager::HandleAccessRequestResponse(
    const std::string& label,
    const media::AudioParameters& output_parameters,
    const blink::mojom::StreamDevicesSet& stream_devices_set,
    MediaStreamRequestResult result) {}

void MediaStreamManager::HandleChangeSourceRequestResponse(
    const std::string& label,
    DeviceRequest* request,
    const blink::mojom::StreamDevicesSet& stream_devices_set) {}

void MediaStreamManager::StopMediaStreamFromBrowser(const std::string& label) {}

void MediaStreamManager::ChangeMediaStreamSourceFromBrowser(
    const std::string& label,
    const DesktopMediaID& media_id,
    bool captured_surface_control_active) {}

void MediaStreamManager::OnRequestStateChangeFromBrowser(
    const std::string& label,
    const DesktopMediaID& media_id,
    blink::mojom::MediaStreamStateChange new_state) {}

void MediaStreamManager::WillDestroyCurrentMessageLoop() {}

void MediaStreamManager::NotifyDevicesChanged(
    MediaDeviceType device_type,
    const blink::WebMediaDeviceInfoArray& devices) {}

bool MediaStreamManager::RequestDone(const DeviceRequest& request) const {}

MediaStreamProvider* MediaStreamManager::GetDeviceManager(
    MediaStreamType stream_type) const {}

void MediaStreamManager::OnMediaStreamUIWindowId(
    MediaStreamType video_type,
    blink::mojom::StreamDevicesSetPtr stream_devices_set,
    gfx::NativeViewId window_id) {}

void MediaStreamManager::DoNativeLogCallbackRegistration(
    int renderer_host_id,
    base::RepeatingCallback<void(const std::string&)> callback) {}

void MediaStreamManager::DoNativeLogCallbackUnregistration(
    int renderer_host_id) {}

// static
bool MediaStreamManager::IsOriginAllowed(int render_process_id,
                                         const url::Origin& origin) {}

void MediaStreamManager::SetCapturingLinkSecured(
    int render_process_id,
    const base::UnguessableToken& session_id,
    MediaStreamType type,
    bool is_secure) {}

void MediaStreamManager::SetStateForTesting(
    size_t request_index,
    blink::mojom::MediaStreamType stream_type,
    MediaRequestState new_state) {}

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
void MediaStreamManager::SetCapturedSurfaceControllerFactoryForTesting(
    CapturedSurfaceControllerFactoryCallback factory) {}
#endif  // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)

void MediaStreamManager::SetGenerateStreamsCallbackForTesting(
    GenerateStreamTestCallback test_callback) {}

MediaStreamDevices MediaStreamManager::ConvertToMediaStreamDevices(
    MediaStreamType stream_type,
    const blink::WebMediaDeviceInfoArray& device_infos) {}

void MediaStreamManager::ActivateTabOnUIThread(const DesktopMediaID source) {}

void MediaStreamManager::OnStreamStarted(const std::string& label) {}

void MediaStreamManager::OnCaptureConfigurationChanged(
    const base::UnguessableToken& session_id) {}

void MediaStreamManager::OnRegionCaptureRectChanged(
    const base::UnguessableToken& session_id,
    const std::optional<gfx::Rect>& region_capture_rect) {}

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
void MediaStreamManager::SetCapturedDisplaySurfaceFocus(
    const std::string& label,
    bool focus,
    bool is_from_microtask,
    bool is_from_timer) {}

void MediaStreamManager::SendWheel(
    GlobalRenderFrameHostId capturer_rfh_id,
    const base::UnguessableToken& session_id,
    blink::mojom::CapturedWheelActionPtr action,
    base::OnceCallback<void(CapturedSurfaceControlResult)> callback) {}

void MediaStreamManager::SetZoomLevel(
    GlobalRenderFrameHostId capturer_rfh_id,
    const base::UnguessableToken& session_id,
    int zoom_level,
    base::OnceCallback<void(blink::mojom::CapturedSurfaceControlResult)>
        callback) {}

void MediaStreamManager::RequestCapturedSurfaceControlPermission(
    GlobalRenderFrameHostId capturer_rfh_id,
    const base::UnguessableToken& session_id,
    base::OnceCallback<void(blink::mojom::CapturedSurfaceControlResult)>
        callback) {}

#endif  // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)

void MediaStreamManager::RegisterDispatcherHost(
    std::unique_ptr<blink::mojom::MediaStreamDispatcherHost> host,
    mojo::PendingReceiver<blink::mojom::MediaStreamDispatcherHost> receiver) {}

void MediaStreamManager::RegisterVideoCaptureHost(
    std::unique_ptr<media::mojom::VideoCaptureHost> host,
    mojo::PendingReceiver<media::mojom::VideoCaptureHost> receiver) {}

std::optional<url::Origin> MediaStreamManager::GetOriginByVideoSessionId(
    const base::UnguessableToken& session_id) {}

// static
PermissionControllerImpl* MediaStreamManager::GetPermissionController(
    GlobalRenderFrameHostId requesting_render_frame_host_id) {}

void MediaStreamManager::SubscribeToPermissionController(
    const std::string& label,
    const DeviceRequest* request) {}

void MediaStreamManager::SubscribeToPermissionControllerOnUIThread(
    const std::string& label,
    GlobalRenderFrameHostId requesting_render_frame_host_id,
    int requester_id,
    int page_request_id,
    bool is_audio_request,
    bool is_video_request,
    const GURL& origin) {}

void MediaStreamManager::SetPermissionSubscriptionIDs(
    const std::string& label,
    GlobalRenderFrameHostId requesting_render_frame_host_id,
    PermissionController::SubscriptionId audio_subscription_id,
    PermissionController::SubscriptionId video_subscription_id) {}

// static
void MediaStreamManager::UnsubscribeFromPermissionControllerOnUIThread(
    GlobalRenderFrameHostId requesting_render_frame_host_id,
    PermissionController::SubscriptionId audio_subscription_id,
    PermissionController::SubscriptionId video_subscription_id) {}

void MediaStreamManager::PermissionChangedCallback(
    GlobalRenderFrameHostId requesting_render_frame_host_id,
    int requester_id,
    int page_request_id,
    blink::mojom::PermissionStatus status) {}

void MediaStreamManager::MaybeStartTrackingCaptureHandleConfig(
    const std::string& label,
    const MediaStreamDevice& captured_device,
    DeviceRequest& request) {}

void MediaStreamManager::MaybeStopTrackingCaptureHandleConfig(
    const std::string& label,
    const MediaStreamDevice& captured_device) {}

void MediaStreamManager::MaybeUpdateTrackedCaptureHandleConfigs(
    const std::string& label,
    const blink::mojom::StreamDevicesSet& new_devices_set,
    DeviceRequest& request) {}

bool MediaStreamManager::ShouldUseFakeUIProxy(
    const DeviceRequest& request) const {}

std::unique_ptr<MediaStreamUIProxy> MediaStreamManager::MakeFakeUIProxy(
    const std::string& label,
    const MediaDeviceEnumeration& enumeration,
    DeviceRequest* request) {}

}  // namespace content