#include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender_impl.h"
#include <memory>
#include <utility>
#include "base/check_op.h"
#include "base/notreached.h"
#include "base/task/single_thread_task_runner.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_dtmf_sender_handler.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_encoded_audio_stream_transformer.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_encoded_video_stream_transformer.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_void_request.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_base.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_std.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 WTF {
template <>
struct CrossThreadCopier<webrtc::RtpParameters>
: public CrossThreadCopierPassThrough<webrtc::RtpParameters> { … };
template <>
struct CrossThreadCopier<webrtc::RTCError>
: public CrossThreadCopierPassThrough<webrtc::RTCError> { … };
}
namespace blink {
namespace {
void OnReplaceTrackCompleted(blink::RTCVoidRequest* request, bool result) { … }
void OnSetParametersCompleted(blink::RTCVoidRequest* request,
webrtc::RTCError result) { … }
}
RtpSenderState::RtpSenderState(
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> signaling_task_runner,
rtc::scoped_refptr<webrtc::RtpSenderInterface> webrtc_sender,
std::unique_ptr<blink::WebRtcMediaStreamTrackAdapterMap::AdapterRef>
track_ref,
std::vector<std::string> stream_ids)
: … { … }
RtpSenderState::RtpSenderState(RtpSenderState&& other)
: … { … }
RtpSenderState::~RtpSenderState() { … }
RtpSenderState& RtpSenderState::operator=(RtpSenderState&& other) { … }
bool RtpSenderState::is_initialized() const { … }
void RtpSenderState::Initialize() { … }
scoped_refptr<base::SingleThreadTaskRunner> RtpSenderState::main_task_runner()
const { … }
scoped_refptr<base::SingleThreadTaskRunner>
RtpSenderState::signaling_task_runner() const { … }
rtc::scoped_refptr<webrtc::RtpSenderInterface> RtpSenderState::webrtc_sender()
const { … }
rtc::scoped_refptr<webrtc::DtlsTransportInterface>
RtpSenderState::webrtc_dtls_transport() const { … }
webrtc::DtlsTransportInformation
RtpSenderState::webrtc_dtls_transport_information() const { … }
const std::unique_ptr<blink::WebRtcMediaStreamTrackAdapterMap::AdapterRef>&
RtpSenderState::track_ref() const { … }
void RtpSenderState::set_track_ref(
std::unique_ptr<blink::WebRtcMediaStreamTrackAdapterMap::AdapterRef>
track_ref) { … }
std::vector<std::string> RtpSenderState::stream_ids() const { … }
class RTCRtpSenderImpl::RTCRtpSenderInternal
: public WTF::ThreadSafeRefCounted<
RTCRtpSenderImpl::RTCRtpSenderInternal,
RTCRtpSenderImpl::RTCRtpSenderInternalTraits> { … };
struct RTCRtpSenderImpl::RTCRtpSenderInternalTraits { … };
uintptr_t RTCRtpSenderImpl::getId(
const webrtc::RtpSenderInterface* webrtc_sender) { … }
RTCRtpSenderImpl::RTCRtpSenderImpl(
rtc::scoped_refptr<webrtc::PeerConnectionInterface> native_peer_connection,
scoped_refptr<blink::WebRtcMediaStreamTrackAdapterMap> track_map,
RtpSenderState state,
bool require_encoded_insertable_streams)
: … { … }
RTCRtpSenderImpl::RTCRtpSenderImpl(const RTCRtpSenderImpl& other)
: … { … }
RTCRtpSenderImpl::~RTCRtpSenderImpl() { … }
RTCRtpSenderImpl& RTCRtpSenderImpl::operator=(const RTCRtpSenderImpl& other) { … }
const RtpSenderState& RTCRtpSenderImpl::state() const { … }
void RTCRtpSenderImpl::set_state(RtpSenderState state) { … }
std::unique_ptr<blink::RTCRtpSenderPlatform> RTCRtpSenderImpl::ShallowCopy()
const { … }
uintptr_t RTCRtpSenderImpl::Id() const { … }
rtc::scoped_refptr<webrtc::DtlsTransportInterface>
RTCRtpSenderImpl::DtlsTransport() { … }
webrtc::DtlsTransportInformation RTCRtpSenderImpl::DtlsTransportInformation() { … }
MediaStreamComponent* RTCRtpSenderImpl::Track() const { … }
Vector<String> RTCRtpSenderImpl::StreamIds() const { … }
void RTCRtpSenderImpl::ReplaceTrack(MediaStreamComponent* with_track,
RTCVoidRequest* request) { … }
std::unique_ptr<blink::RtcDtmfSenderHandler> RTCRtpSenderImpl::GetDtmfSender()
const { … }
std::unique_ptr<webrtc::RtpParameters> RTCRtpSenderImpl::GetParameters() const { … }
void RTCRtpSenderImpl::SetParameters(
Vector<webrtc::RtpEncodingParameters> encodings,
std::optional<webrtc::DegradationPreference> degradation_preference,
blink::RTCVoidRequest* request) { … }
void RTCRtpSenderImpl::GetStats(RTCStatsReportCallback callback) { … }
void RTCRtpSenderImpl::SetStreams(const Vector<String>& stream_ids) { … }
void RTCRtpSenderImpl::ReplaceTrack(MediaStreamComponent* with_track,
base::OnceCallback<void(bool)> callback) { … }
bool RTCRtpSenderImpl::RemoveFromPeerConnection(
webrtc::PeerConnectionInterface* pc) { … }
RTCEncodedAudioStreamTransformer*
RTCRtpSenderImpl::GetEncodedAudioStreamTransformer() const { … }
RTCEncodedVideoStreamTransformer*
RTCRtpSenderImpl::GetEncodedVideoStreamTransformer() const { … }
}