#include "modules/rtp_rtcp/source/rtcp_transceiver_impl.h"
#include <algorithm>
#include <utility>
#include "absl/algorithm/container.h"
#include "absl/memory/memory.h"
#include "absl/types/optional.h"
#include "api/video/video_bitrate_allocation.h"
#include "modules/rtp_rtcp/include/receive_statistics.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/ntp_time_util.h"
#include "modules/rtp_rtcp/source/rtcp_packet.h"
#include "modules/rtp_rtcp/source/rtcp_packet/bye.h"
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
#include "modules/rtp_rtcp/source/rtcp_packet/extended_reports.h"
#include "modules/rtp_rtcp/source/rtcp_packet/fir.h"
#include "modules/rtp_rtcp/source/rtcp_packet/nack.h"
#include "modules/rtp_rtcp/source/rtcp_packet/pli.h"
#include "modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "modules/rtp_rtcp/source/rtcp_packet/sdes.h"
#include "modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
#include "modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
#include "rtc_base/checks.h"
#include "rtc_base/containers/flat_map.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/divide_round.h"
#include "rtc_base/task_utils/repeating_task.h"
#include "rtc_base/time_utils.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
namespace {
struct SenderReportTimes { … };
std::function<void(rtc::ArrayView<const uint8_t>)> GetRtcpTransport(
const RtcpTransceiverConfig& config) { … }
}
struct RtcpTransceiverImpl::RemoteSenderState { … };
struct RtcpTransceiverImpl::LocalSenderState { … };
class RtcpTransceiverImpl::PacketSender { … };
RtcpTransceiverImpl::RtcpTransceiverImpl(const RtcpTransceiverConfig& config)
: … { … }
RtcpTransceiverImpl::~RtcpTransceiverImpl() = default;
void RtcpTransceiverImpl::AddMediaReceiverRtcpObserver(
uint32_t remote_ssrc,
MediaReceiverRtcpObserver* observer) { … }
void RtcpTransceiverImpl::RemoveMediaReceiverRtcpObserver(
uint32_t remote_ssrc,
MediaReceiverRtcpObserver* observer) { … }
bool RtcpTransceiverImpl::AddMediaSender(uint32_t local_ssrc,
RtpStreamRtcpHandler* handler) { … }
bool RtcpTransceiverImpl::RemoveMediaSender(uint32_t local_ssrc) { … }
void RtcpTransceiverImpl::SetReadyToSend(bool ready) { … }
void RtcpTransceiverImpl::ReceivePacket(rtc::ArrayView<const uint8_t> packet,
Timestamp now) { … }
void RtcpTransceiverImpl::SendCompoundPacket() { … }
void RtcpTransceiverImpl::SetRemb(int64_t bitrate_bps,
std::vector<uint32_t> ssrcs) { … }
void RtcpTransceiverImpl::UnsetRemb() { … }
void RtcpTransceiverImpl::SendNack(uint32_t ssrc,
std::vector<uint16_t> sequence_numbers) { … }
void RtcpTransceiverImpl::SendPictureLossIndication(uint32_t ssrc) { … }
void RtcpTransceiverImpl::SendFullIntraRequest(
rtc::ArrayView<const uint32_t> ssrcs,
bool new_request) { … }
void RtcpTransceiverImpl::HandleReceivedPacket(
const rtcp::CommonHeader& rtcp_packet_header,
Timestamp now,
std::vector<ReportBlockData>& report_blocks) { … }
void RtcpTransceiverImpl::HandleBye(
const rtcp::CommonHeader& rtcp_packet_header) { … }
void RtcpTransceiverImpl::HandleSenderReport(
const rtcp::CommonHeader& rtcp_packet_header,
Timestamp now,
std::vector<ReportBlockData>& report_blocks) { … }
void RtcpTransceiverImpl::HandleReceiverReport(
const rtcp::CommonHeader& rtcp_packet_header,
Timestamp now,
std::vector<ReportBlockData>& report_blocks) { … }
void RtcpTransceiverImpl::HandleReportBlocks(
uint32_t sender_ssrc,
Timestamp now,
rtc::ArrayView<const rtcp::ReportBlock> rtcp_report_blocks,
std::vector<ReportBlockData>& report_blocks) { … }
void RtcpTransceiverImpl::HandlePayloadSpecificFeedback(
const rtcp::CommonHeader& rtcp_packet_header,
Timestamp now) { … }
void RtcpTransceiverImpl::HandleFir(
const rtcp::CommonHeader& rtcp_packet_header) { … }
void RtcpTransceiverImpl::HandlePli(
const rtcp::CommonHeader& rtcp_packet_header) { … }
void RtcpTransceiverImpl::HandleRemb(
const rtcp::CommonHeader& rtcp_packet_header,
Timestamp now) { … }
void RtcpTransceiverImpl::HandleRtpFeedback(
const rtcp::CommonHeader& rtcp_packet_header,
Timestamp now) { … }
void RtcpTransceiverImpl::HandleNack(
const rtcp::CommonHeader& rtcp_packet_header) { … }
void RtcpTransceiverImpl::HandleTransportFeedback(
const rtcp::CommonHeader& rtcp_packet_header,
Timestamp now) { … }
void RtcpTransceiverImpl::HandleExtendedReports(
const rtcp::CommonHeader& rtcp_packet_header,
Timestamp now) { … }
void RtcpTransceiverImpl::HandleDlrr(const rtcp::Dlrr& dlrr, Timestamp now) { … }
void RtcpTransceiverImpl::ProcessReportBlocks(
Timestamp now,
rtc::ArrayView<const ReportBlockData> report_blocks) { … }
void RtcpTransceiverImpl::HandleTargetBitrate(
const rtcp::TargetBitrate& target_bitrate,
uint32_t remote_ssrc) { … }
void RtcpTransceiverImpl::ReschedulePeriodicCompoundPackets() { … }
void RtcpTransceiverImpl::SchedulePeriodicCompoundPackets(TimeDelta delay) { … }
std::vector<uint32_t> RtcpTransceiverImpl::FillReports(
Timestamp now,
ReservedBytes reserved,
PacketSender& rtcp_sender) { … }
void RtcpTransceiverImpl::CreateCompoundPacket(Timestamp now,
size_t reserved_bytes,
PacketSender& sender) { … }
void RtcpTransceiverImpl::SendPeriodicCompoundPacket() { … }
void RtcpTransceiverImpl::SendCombinedRtcpPacket(
std::vector<std::unique_ptr<rtcp::RtcpPacket>> rtcp_packets) { … }
void RtcpTransceiverImpl::SendImmediateFeedback(
const rtcp::RtcpPacket& rtcp_packet) { … }
std::vector<rtcp::ReportBlock> RtcpTransceiverImpl::CreateReportBlocks(
Timestamp now,
size_t num_max_blocks) { … }
}