#include "pc/rtp_transceiver.h"
#include <stdint.h>
#include <algorithm>
#include <cstddef>
#include <functional>
#include <iterator>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "absl/algorithm/container.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_options.h"
#include "api/crypto/crypto_options.h"
#include "api/field_trials_view.h"
#include "api/jsep.h"
#include "api/media_types.h"
#include "api/rtc_error.h"
#include "api/rtp_parameters.h"
#include "api/rtp_receiver_interface.h"
#include "api/rtp_sender_interface.h"
#include "api/rtp_transceiver_direction.h"
#include "api/scoped_refptr.h"
#include "api/sequence_checker.h"
#include "api/task_queue/pending_task_safety_flag.h"
#include "api/task_queue/task_queue_base.h"
#include "api/video/video_bitrate_allocator_factory.h"
#include "api/video_codecs/scalability_mode.h"
#include "media/base/codec.h"
#include "media/base/media_channel.h"
#include "media/base/media_config.h"
#include "media/base/media_engine.h"
#include "pc/channel.h"
#include "pc/channel_interface.h"
#include "pc/connection_context.h"
#include "pc/rtp_media_utils.h"
#include "pc/rtp_receiver.h"
#include "pc/rtp_receiver_proxy.h"
#include "pc/rtp_sender.h"
#include "pc/rtp_sender_proxy.h"
#include "pc/rtp_transport_internal.h"
#include "pc/session_description.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread.h"
namespace webrtc {
namespace {
RTCError VerifyCodecPreferences(
const std::vector<RtpCodecCapability>& unfiltered_codecs,
const std::vector<cricket::Codec>& recv_codecs,
const FieldTrialsView& field_trials) { … }
TaskQueueBase* GetCurrentTaskQueueOrThread() { … }
}
RtpTransceiver::RtpTransceiver(cricket::MediaType media_type,
ConnectionContext* context)
: … { … }
RtpTransceiver::RtpTransceiver(
rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> sender,
rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>
receiver,
ConnectionContext* context,
std::vector<RtpHeaderExtensionCapability> header_extensions_to_negotiate,
std::function<void()> on_negotiation_needed)
: … { … }
RtpTransceiver::~RtpTransceiver() { … }
RTCError RtpTransceiver::CreateChannel(
absl::string_view mid,
Call* call_ptr,
const cricket::MediaConfig& media_config,
bool srtp_required,
CryptoOptions crypto_options,
const cricket::AudioOptions& audio_options,
const cricket::VideoOptions& video_options,
VideoBitrateAllocatorFactory* video_bitrate_allocator_factory,
std::function<RtpTransportInternal*(absl::string_view)> transport_lookup) { … }
void RtpTransceiver::SetChannel(
std::unique_ptr<cricket::ChannelInterface> channel,
std::function<RtpTransportInternal*(const std::string&)> transport_lookup) { … }
void RtpTransceiver::ClearChannel() { … }
void RtpTransceiver::PushNewMediaChannelAndDeleteChannel(
std::unique_ptr<cricket::ChannelInterface> channel_to_delete) { … }
void RtpTransceiver::AddSender(
rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> sender) { … }
bool RtpTransceiver::RemoveSender(RtpSenderInterface* sender) { … }
void RtpTransceiver::AddReceiver(
rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>
receiver) { … }
bool RtpTransceiver::RemoveReceiver(RtpReceiverInterface* receiver) { … }
rtc::scoped_refptr<RtpSenderInternal> RtpTransceiver::sender_internal() const { … }
rtc::scoped_refptr<RtpReceiverInternal> RtpTransceiver::receiver_internal()
const { … }
cricket::MediaType RtpTransceiver::media_type() const { … }
absl::optional<std::string> RtpTransceiver::mid() const { … }
void RtpTransceiver::OnFirstPacketReceived() { … }
rtc::scoped_refptr<RtpSenderInterface> RtpTransceiver::sender() const { … }
rtc::scoped_refptr<RtpReceiverInterface> RtpTransceiver::receiver() const { … }
void RtpTransceiver::set_current_direction(RtpTransceiverDirection direction) { … }
void RtpTransceiver::set_fired_direction(
absl::optional<RtpTransceiverDirection> direction) { … }
bool RtpTransceiver::stopped() const { … }
bool RtpTransceiver::stopping() const { … }
RtpTransceiverDirection RtpTransceiver::direction() const { … }
RTCError RtpTransceiver::SetDirectionWithError(
RtpTransceiverDirection new_direction) { … }
absl::optional<RtpTransceiverDirection> RtpTransceiver::current_direction()
const { … }
absl::optional<RtpTransceiverDirection> RtpTransceiver::fired_direction()
const { … }
void RtpTransceiver::StopSendingAndReceiving() { … }
RTCError RtpTransceiver::StopStandard() { … }
void RtpTransceiver::StopInternal() { … }
void RtpTransceiver::StopTransceiverProcedure() { … }
RTCError RtpTransceiver::SetCodecPreferences(
rtc::ArrayView<RtpCodecCapability> codec_capabilities) { … }
std::vector<RtpHeaderExtensionCapability>
RtpTransceiver::GetHeaderExtensionsToNegotiate() const { … }
std::vector<RtpHeaderExtensionCapability>
RtpTransceiver::GetNegotiatedHeaderExtensions() const { … }
bool IsMandatoryHeaderExtension(const std::string& uri) { … }
RTCError RtpTransceiver::SetHeaderExtensionsToNegotiate(
rtc::ArrayView<const RtpHeaderExtensionCapability> header_extensions) { … }
void RtpTransceiver::OnNegotiationUpdate(
SdpType sdp_type,
const cricket::MediaContentDescription* content) { … }
void RtpTransceiver::SetPeerConnectionClosed() { … }
}