#include "third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source.h"
#include <utility>
#include "base/functional/callback.h"
#include "base/task/single_thread_task_runner.h"
#include "base/token.h"
#include "build/build_config.h"
#include "media/capture/mojom/video_capture_types.mojom-blink.h"
#include "media/capture/video_capture_types.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-blink.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/video_capture/video_capturer_source.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
MediaStreamRequestResult;
MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource(
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
LocalFrame* frame,
SourceStoppedCallback stop_callback,
std::unique_ptr<VideoCapturerSource> source)
: … { … }
MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource(
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
LocalFrame* frame,
SourceStoppedCallback stop_callback,
const MediaStreamDevice& device,
const media::VideoCaptureParams& capture_params,
DeviceCapturerFactoryCallback device_capturer_factory_callback)
: … { … }
MediaStreamVideoCapturerSource::~MediaStreamVideoCapturerSource() { … }
void MediaStreamVideoCapturerSource::SetDeviceCapturerFactoryCallbackForTesting(
DeviceCapturerFactoryCallback testing_factory_callback) { … }
void MediaStreamVideoCapturerSource::OnSourceCanDiscardAlpha(
bool can_discard_alpha) { … }
void MediaStreamVideoCapturerSource::RequestRefreshFrame() { … }
void MediaStreamVideoCapturerSource::OnLog(const std::string& message) { … }
void MediaStreamVideoCapturerSource::OnHasConsumers(bool has_consumers) { … }
void MediaStreamVideoCapturerSource::OnCapturingLinkSecured(bool is_secure) { … }
void MediaStreamVideoCapturerSource::StartSourceImpl(
VideoCaptureDeliverFrameCB frame_callback,
EncodedVideoFrameCB encoded_frame_callback,
VideoCaptureSubCaptureTargetVersionCB sub_capture_target_version_callback,
VideoCaptureNotifyFrameDroppedCB frame_dropped_callback) { … }
media::VideoCaptureFeedbackCB
MediaStreamVideoCapturerSource::GetFeedbackCallback() const { … }
void MediaStreamVideoCapturerSource::StopSourceImpl() { … }
void MediaStreamVideoCapturerSource::StopSourceForRestartImpl() { … }
void MediaStreamVideoCapturerSource::RestartSourceImpl(
const media::VideoCaptureFormat& new_format) { … }
std::optional<media::VideoCaptureFormat>
MediaStreamVideoCapturerSource::GetCurrentFormat() const { … }
void MediaStreamVideoCapturerSource::ChangeSourceImpl(
const MediaStreamDevice& new_device) { … }
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
void MediaStreamVideoCapturerSource::ApplySubCaptureTarget(
media::mojom::blink::SubCaptureTargetType type,
const base::Token& sub_capture_target,
uint32_t sub_capture_target_version,
base::OnceCallback<void(media::mojom::ApplySubCaptureTargetResult)>
callback) { … }
std::optional<uint32_t>
MediaStreamVideoCapturerSource::GetNextSubCaptureTargetVersion() { … }
#endif
uint32_t MediaStreamVideoCapturerSource::GetSubCaptureTargetVersion() const { … }
base::WeakPtr<MediaStreamVideoSource>
MediaStreamVideoCapturerSource::GetWeakPtr() { … }
void MediaStreamVideoCapturerSource::OnRunStateChanged(
const media::VideoCaptureParams& new_capture_params,
RunState run_state) { … }
mojom::blink::MediaStreamDispatcherHost*
MediaStreamVideoCapturerSource::GetMediaStreamDispatcherHost() { … }
void MediaStreamVideoCapturerSource::SetMediaStreamDispatcherHostForTesting(
mojo::PendingRemote<mojom::blink::MediaStreamDispatcherHost> host) { … }
VideoCapturerSource* MediaStreamVideoCapturerSource::GetSourceForTesting() { … }
}