chromium/third_party/blink/renderer/modules/mediastream/media_stream_video_source.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h"

#include <algorithm>
#include <limits>
#include <memory>
#include <numeric>
#include <utility>

#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/string_number_conversions.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/task/thread_pool.h"
#include "base/token.h"
#include "build/build_config.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/platform.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_video_track.h"
#include "third_party/blink/renderer/modules/mediastream/video_track_adapter.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_source.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_media.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"

namespace blink {

// static
MediaStreamVideoSource* MediaStreamVideoSource::GetVideoSource(
    MediaStreamSource* source) {}

MediaStreamVideoSource::MediaStreamVideoSource(
    scoped_refptr<base::SingleThreadTaskRunner> task_runner)
    :{}

MediaStreamVideoSource::~MediaStreamVideoSource() {}

void MediaStreamVideoSource::AddTrack(
    MediaStreamVideoTrack* track,
    const VideoTrackAdapterSettings& track_adapter_settings,
    const VideoCaptureDeliverFrameCB& frame_callback,
    const VideoCaptureNotifyFrameDroppedCB& notify_frame_dropped_callback,
    const EncodedVideoFrameCB& encoded_frame_callback,
    const VideoCaptureSubCaptureTargetVersionCB&
        sub_capture_target_version_callback,
    const VideoTrackSettingsCallback& settings_callback,
    const VideoTrackFormatCallback& format_callback,
    ConstraintsOnceCallback callback) {}

void MediaStreamVideoSource::RemoveTrack(MediaStreamVideoTrack* video_track,
                                         base::OnceClosure callback) {}

void MediaStreamVideoSource::DidStopSource(RestartResult result) {}

void MediaStreamVideoSource::ReconfigureTrack(
    MediaStreamVideoTrack* track,
    const VideoTrackAdapterSettings& adapter_settings) {}

void MediaStreamVideoSource::StopForRestart(RestartCallback callback,
                                            bool send_black_frame) {}

void MediaStreamVideoSource::StopSourceForRestartImpl() {}

void MediaStreamVideoSource::OnStopForRestartDone(bool did_stop_for_restart) {}

void MediaStreamVideoSource::Restart(
    const media::VideoCaptureFormat& new_format,
    RestartCallback callback) {}

void MediaStreamVideoSource::RestartSourceImpl(
    const media::VideoCaptureFormat& new_format) {}

void MediaStreamVideoSource::OnRestartDone(bool did_restart) {}

void MediaStreamVideoSource::OnRestartBySourceSwitchDone(bool did_restart) {}

void MediaStreamVideoSource::UpdateHasConsumers(MediaStreamVideoTrack* track,
                                                bool has_consumers) {}

void MediaStreamVideoSource::UpdateCapturingLinkSecure(
    MediaStreamVideoTrack* track,
    bool is_secure) {}

void MediaStreamVideoSource::NotifyCapturingLinkSecured(
    size_t num_encoded_sinks) {}

void MediaStreamVideoSource::SetDeviceRotationDetection(bool enabled) {}

base::SequencedTaskRunner* MediaStreamVideoSource::video_task_runner() const {}

std::optional<media::VideoCaptureFormat>
MediaStreamVideoSource::GetCurrentFormat() const {}

size_t MediaStreamVideoSource::CountEncodedSinks() const {}

void MediaStreamVideoSource::UpdateNumEncodedSinks() {}

void MediaStreamVideoSource::DoChangeSource(
    const MediaStreamDevice& new_device) {}

void MediaStreamVideoSource::DoStopSource() {}

void MediaStreamVideoSource::OnStartDone(
    mojom::blink::MediaStreamRequestResult result) {}

void MediaStreamVideoSource::FinalizeAddPendingTracks(
    mojom::blink::MediaStreamRequestResult result) {}

void MediaStreamVideoSource::StartFrameMonitoring() {}

void MediaStreamVideoSource::SetReadyState(
    WebMediaStreamSource::ReadyState state) {}

void MediaStreamVideoSource::SetMutedState(bool muted_state) {}

void MediaStreamVideoSource::UpdateTrackSettings(
    MediaStreamVideoTrack* track,
    const VideoTrackAdapterSettings& adapter_settings) {}

bool MediaStreamVideoSource::SupportsEncodedOutput() const {}

#if !BUILDFLAG(IS_ANDROID)
void MediaStreamVideoSource::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>
MediaStreamVideoSource::GetNextSubCaptureTargetVersion() {}
#endif

uint32_t MediaStreamVideoSource::GetSubCaptureTargetVersion() const {}

VideoCaptureFeedbackCB MediaStreamVideoSource::GetFeedbackCallback() const {}

scoped_refptr<VideoTrackAdapter> MediaStreamVideoSource::GetTrackAdapter() {}

void MediaStreamVideoSource::UpdateCanDiscardAlpha() {}

}  // namespace blink