#include "third_party/blink/renderer/modules/mediastream/browser_capture_media_stream_track.h"
#include <optional>
#include "base/metrics/histogram_functions.h"
#include "base/not_fatal_until.h"
#include "base/token.h"
#include "base/types/expected.h"
#include "base/uuid.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/web/modules/mediastream/media_stream_video_source.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/modules/mediastream/crop_target.h"
#include "third_party/blink/renderer/modules/mediastream/restriction_target.h"
#include "third_party/blink/renderer/modules/mediastream/sub_capture_target.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/region_capture_crop_id.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
namespace {
#if !BUILDFLAG(IS_ANDROID)
ApplySubCaptureTargetResult;
std::optional<base::Token> IdStringToToken(const String& crop_id) { … }
void RaiseApplySubCaptureTargetException(
ScriptPromiseResolverWithTracker<ApplySubCaptureTargetResult, IDLUndefined>*
resolver,
DOMExceptionCode exception_code,
const WTF::String& exception_text,
ApplySubCaptureTargetResult result) { … }
void ResolveApplySubCaptureTargetPromiseHelper(
ScriptPromiseResolverWithTracker<ApplySubCaptureTargetResult, IDLUndefined>*
resolver,
media::mojom::ApplySubCaptureTargetResult result) { … }
#endif
}
BrowserCaptureMediaStreamTrack::BrowserCaptureMediaStreamTrack(
ExecutionContext* execution_context,
MediaStreamComponent* component,
base::OnceClosure callback)
: … { … }
BrowserCaptureMediaStreamTrack::BrowserCaptureMediaStreamTrack(
ExecutionContext* execution_context,
MediaStreamComponent* component,
MediaStreamSource::ReadyState ready_state,
base::OnceClosure callback)
: … { … }
#if !BUILDFLAG(IS_ANDROID)
void BrowserCaptureMediaStreamTrack::Trace(Visitor* visitor) const { … }
#endif
ScriptPromise<IDLUndefined> BrowserCaptureMediaStreamTrack::cropTo(
ScriptState* script_state,
CropTarget* target,
ExceptionState& exception_state) { … }
ScriptPromise<IDLUndefined> BrowserCaptureMediaStreamTrack::restrictTo(
ScriptState* script_state,
RestrictionTarget* target,
ExceptionState& exception_state) { … }
BrowserCaptureMediaStreamTrack* BrowserCaptureMediaStreamTrack::clone(
ExecutionContext* execution_context) { … }
ScriptPromise<IDLUndefined>
BrowserCaptureMediaStreamTrack::ApplySubCaptureTarget(
ScriptState* script_state,
SubCaptureTarget::Type type,
SubCaptureTarget* target,
ExceptionState& exception_state) { … }
#if !BUILDFLAG(IS_ANDROID)
void BrowserCaptureMediaStreamTrack::OnResultFromBrowserProcess(
uint32_t sub_capture_target_version,
media::mojom::ApplySubCaptureTargetResult result) { … }
void BrowserCaptureMediaStreamTrack::OnSubCaptureTargetVersionObserved(
uint32_t sub_capture_target_version) { … }
void BrowserCaptureMediaStreamTrack::MaybeFinalizeCropPromise(
BrowserCaptureMediaStreamTrack::PromiseMapIterator iter) { … }
#endif
}