#include "third_party/blink/renderer/modules/mediastream/user_media_client.h"
#include <stddef.h>
#include <algorithm>
#include <utility>
#include "base/location.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h"
#include "third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/modules/mediastream/apply_constraints_processor.h"
#include "third_party/blink/renderer/modules/mediastream/media_constraints.h"
#include "third_party/blink/renderer/modules/peerconnection/peer_connection_tracker.h"
#include "third_party/blink/renderer/platform/mediastream/webrtc_uma_histograms.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
namespace {
static int32_t g_next_request_id = …;
void UpdateAPICount(UserMediaRequestType media_type) { … }
}
class UserMediaClient::RequestQueue final
: public GarbageCollected<UserMediaClient::RequestQueue> { … };
UserMediaClient::RequestQueue::RequestQueue(
LocalFrame* frame,
UserMediaProcessor* user_media_processor,
UserMediaClient* user_media_client,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
UserMediaClient::RequestQueue::~RequestQueue() { … }
void UserMediaClient::RequestQueue::EnqueueAndMaybeProcess(Request* request) { … }
void UserMediaClient::RequestQueue::CancelUserMediaRequest(
UserMediaRequest* user_media_request) { … }
void UserMediaClient::RequestQueue::DeleteAllUserMediaRequests() { … }
void UserMediaClient::RequestQueue::KeepDeviceAliveForTransfer(
base::UnguessableToken session_id,
base::UnguessableToken transfer_id,
UserMediaProcessor::KeepDeviceAliveForTransferCallback keep_alive_cb) { … }
void UserMediaClient::RequestQueue::Trace(Visitor* visitor) const { … }
void UserMediaClient::RequestQueue::MaybeProcessNextRequestInfo() { … }
void UserMediaClient::RequestQueue::CurrentRequestCompleted() { … }
UserMediaClient::Request::Request(UserMediaRequest* user_media_request)
: … { … }
UserMediaClient::Request::Request(blink::ApplyConstraintsRequest* request)
: … { … }
UserMediaClient::Request::Request(MediaStreamComponent* track_to_stop)
: … { … }
UserMediaClient::Request::~Request() = default;
UserMediaRequest* UserMediaClient::Request::MoveUserMediaRequest() { … }
UserMediaClient::UserMediaClient(
LocalFrame* frame,
UserMediaProcessor* user_media_processor,
UserMediaProcessor* display_user_media_processor,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
UserMediaClient::UserMediaClient(
LocalFrame* frame,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
void UserMediaClient::RequestUserMedia(UserMediaRequest* user_media_request) { … }
void UserMediaClient::ApplyConstraints(
blink::ApplyConstraintsRequest* user_media_request) { … }
void UserMediaClient::StopTrack(MediaStreamComponent* track) { … }
bool UserMediaClient::IsCapturing() { … }
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
void UserMediaClient::FocusCapturedSurface(const String& label, bool focus) { … }
#endif
void UserMediaClient::CancelUserMediaRequest(
UserMediaRequest* user_media_request) { … }
void UserMediaClient::DeleteAllUserMediaRequests() { … }
void UserMediaClient::ContextDestroyed() { … }
void UserMediaClient::Trace(Visitor* visitor) const { … }
void UserMediaClient::SetMediaDevicesDispatcherForTesting(
mojo::PendingRemote<blink::mojom::blink::MediaDevicesDispatcherHost>
media_devices_dispatcher) { … }
blink::mojom::blink::MediaDevicesDispatcherHost*
UserMediaClient::GetMediaDevicesDispatcher() { … }
const char UserMediaClient::kSupplementName[] = …;
UserMediaClient* UserMediaClient::From(LocalDOMWindow* window) { … }
void UserMediaClient::KeepDeviceAliveForTransfer(
base::UnguessableToken session_id,
base::UnguessableToken transfer_id,
UserMediaProcessor::KeepDeviceAliveForTransferCallback keep_alive_cb) { … }
UserMediaClient::RequestQueue* UserMediaClient::GetRequestQueue(
mojom::blink::MediaStreamType media_stream_type) { … }
}