#include "third_party/blink/renderer/modules/peerconnection/media_stream_video_webrtc_sink.h"
#include <algorithm>
#include <memory>
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/numerics/safe_conversions.h"
#include "base/sequence_checker.h"
#include "base/synchronization/lock.h"
#include "base/task/single_thread_task_runner.h"
#include "third_party/blink/public/web/modules/mediastream/web_media_stream_utils.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_video_track.h"
#include "third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_component.h"
#include "third_party/blink/renderer/platform/peerconnection/webrtc_video_track_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"
#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
namespace blink {
namespace {
std::optional<bool> ToAbslOptionalBool(const std::optional<bool>& value) { … }
webrtc::VideoTrackInterface::ContentHint ContentHintTypeToWebRtcContentHint(
WebMediaStreamTrack::ContentHintType content_hint) { … }
void RequestRefreshFrameOnRenderTaskRunner(MediaStreamComponent* component) { … }
void RequestRefreshFrame(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
CrossThreadWeakPersistent<MediaStreamComponent> component) { … }
}
class MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter
: public WTF::ThreadSafeRefCounted<WebRtcVideoSourceAdapter> { … };
MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::WebRtcVideoSourceAdapter(
const scoped_refptr<base::SingleThreadTaskRunner>&
libjingle_network_task_runner,
const scoped_refptr<WebRtcVideoTrackSource>& source,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::
~WebRtcVideoSourceAdapter() { … }
void MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::
ReleaseSourceOnMainThread() { … }
void MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::OnVideoFrameOnIO(
scoped_refptr<media::VideoFrame> frame,
base::TimeTicks estimated_capture_time) { … }
void MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::
OnNotifyVideoFrameDroppedOnIO(media::VideoCaptureFrameDropReason) { … }
void MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::
OnVideoFrameOnNetworkThread(scoped_refptr<media::VideoFrame> frame) { … }
void MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::
OnNotifyVideoFrameDroppedOnNetworkThread() { … }
MediaStreamVideoWebRtcSink::MediaStreamVideoWebRtcSink(
MediaStreamComponent* component,
PeerConnectionDependencyFactory* factory,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { … }
MediaStreamVideoWebRtcSink::~MediaStreamVideoWebRtcSink() { … }
void MediaStreamVideoWebRtcSink::OnEnabledChanged(bool enabled) { … }
void MediaStreamVideoWebRtcSink::OnContentHintChanged(
WebMediaStreamTrack::ContentHintType content_hint) { … }
void MediaStreamVideoWebRtcSink::OnVideoConstraintsChanged(
std::optional<double> min_fps,
std::optional<double> max_fps) { … }
std::optional<bool> MediaStreamVideoWebRtcSink::SourceNeedsDenoisingForTesting()
const { … }
}