#include "pc/rtp_transmission_manager.h"
#include <type_traits>
#include <utility>
#include "absl/types/optional.h"
#include "api/peer_connection_interface.h"
#include "api/rtp_transceiver_direction.h"
#include "pc/audio_rtp_receiver.h"
#include "pc/channel_interface.h"
#include "pc/legacy_stats_collector_interface.h"
#include "pc/video_rtp_receiver.h"
#include "rtc_base/checks.h"
#include "rtc_base/crypto_random.h"
#include "rtc_base/logging.h"
namespace webrtc {
namespace {
static const char kDefaultAudioSenderId[] = …;
static const char kDefaultVideoSenderId[] = …;
}
RtpTransmissionManager::RtpTransmissionManager(
bool is_unified_plan,
ConnectionContext* context,
UsagePattern* usage_pattern,
PeerConnectionObserver* observer,
LegacyStatsCollectorInterface* legacy_stats,
std::function<void()> on_negotiation_needed)
: … { … }
void RtpTransmissionManager::Close() { … }
void RtpTransmissionManager::OnSetStreams() { … }
void RtpTransmissionManager::OnNegotiationNeeded() { … }
PeerConnectionObserver* RtpTransmissionManager::Observer() const { … }
cricket::VoiceMediaSendChannelInterface*
RtpTransmissionManager::voice_media_send_channel() const { … }
cricket::VideoMediaSendChannelInterface*
RtpTransmissionManager::video_media_send_channel() const { … }
cricket::VoiceMediaReceiveChannelInterface*
RtpTransmissionManager::voice_media_receive_channel() const { … }
cricket::VideoMediaReceiveChannelInterface*
RtpTransmissionManager::video_media_receive_channel() const { … }
RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>
RtpTransmissionManager::AddTrack(
rtc::scoped_refptr<MediaStreamTrackInterface> track,
const std::vector<std::string>& stream_ids,
const std::vector<RtpEncodingParameters>* init_send_encodings) { … }
RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>
RtpTransmissionManager::AddTrackPlanB(
rtc::scoped_refptr<MediaStreamTrackInterface> track,
const std::vector<std::string>& stream_ids,
const std::vector<RtpEncodingParameters>* init_send_encodings) { … }
RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>
RtpTransmissionManager::AddTrackUnifiedPlan(
rtc::scoped_refptr<MediaStreamTrackInterface> track,
const std::vector<std::string>& stream_ids,
const std::vector<RtpEncodingParameters>* init_send_encodings) { … }
rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>
RtpTransmissionManager::CreateSender(
cricket::MediaType media_type,
const std::string& id,
rtc::scoped_refptr<MediaStreamTrackInterface> track,
const std::vector<std::string>& stream_ids,
const std::vector<RtpEncodingParameters>& send_encodings) { … }
rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>
RtpTransmissionManager::CreateReceiver(cricket::MediaType media_type,
const std::string& receiver_id) { … }
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>
RtpTransmissionManager::CreateAndAddTransceiver(
rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> sender,
rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>
receiver) { … }
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>
RtpTransmissionManager::FindFirstTransceiverForAddedTrack(
rtc::scoped_refptr<MediaStreamTrackInterface> track,
const std::vector<RtpEncodingParameters>* init_send_encodings) { … }
std::vector<rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>>
RtpTransmissionManager::GetSendersInternal() const { … }
std::vector<
rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>>
RtpTransmissionManager::GetReceiversInternal() const { … }
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>
RtpTransmissionManager::GetAudioTransceiver() const { … }
rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>
RtpTransmissionManager::GetVideoTransceiver() const { … }
void RtpTransmissionManager::AddAudioTrack(AudioTrackInterface* track,
MediaStreamInterface* stream) { … }
void RtpTransmissionManager::RemoveAudioTrack(AudioTrackInterface* track,
MediaStreamInterface* stream) { … }
void RtpTransmissionManager::AddVideoTrack(VideoTrackInterface* track,
MediaStreamInterface* stream) { … }
void RtpTransmissionManager::RemoveVideoTrack(VideoTrackInterface* track,
MediaStreamInterface* stream) { … }
void RtpTransmissionManager::CreateAudioReceiver(
MediaStreamInterface* stream,
const RtpSenderInfo& remote_sender_info) { … }
void RtpTransmissionManager::CreateVideoReceiver(
MediaStreamInterface* stream,
const RtpSenderInfo& remote_sender_info) { … }
rtc::scoped_refptr<RtpReceiverInterface>
RtpTransmissionManager::RemoveAndStopReceiver(
const RtpSenderInfo& remote_sender_info) { … }
void RtpTransmissionManager::OnRemoteSenderAdded(
const RtpSenderInfo& sender_info,
MediaStreamInterface* stream,
cricket::MediaType media_type) { … }
void RtpTransmissionManager::OnRemoteSenderRemoved(
const RtpSenderInfo& sender_info,
MediaStreamInterface* stream,
cricket::MediaType media_type) { … }
void RtpTransmissionManager::OnLocalSenderAdded(
const RtpSenderInfo& sender_info,
cricket::MediaType media_type) { … }
void RtpTransmissionManager::OnLocalSenderRemoved(
const RtpSenderInfo& sender_info,
cricket::MediaType media_type) { … }
std::vector<RtpSenderInfo>* RtpTransmissionManager::GetRemoteSenderInfos(
cricket::MediaType media_type) { … }
std::vector<RtpSenderInfo>* RtpTransmissionManager::GetLocalSenderInfos(
cricket::MediaType media_type) { … }
const RtpSenderInfo* RtpTransmissionManager::FindSenderInfo(
const std::vector<RtpSenderInfo>& infos,
const std::string& stream_id,
const std::string& sender_id) const { … }
rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>
RtpTransmissionManager::FindSenderForTrack(
MediaStreamTrackInterface* track) const { … }
rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>
RtpTransmissionManager::FindSenderById(const std::string& sender_id) const { … }
rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>
RtpTransmissionManager::FindReceiverById(const std::string& receiver_id) const { … }
cricket::MediaEngineInterface* RtpTransmissionManager::media_engine() const { … }
}