#include "modules/rtp_rtcp/source/rtcp_receiver.h"
#include <string.h>
#include <algorithm>
#include <limits>
#include <map>
#include <memory>
#include <utility>
#include <vector>
#include "api/transport/field_trial_based_config.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video/video_bitrate_allocator.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/bye.h"
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
#include "modules/rtp_rtcp/source/rtcp_packet/compound_packet.h"
#include "modules/rtp_rtcp/source/rtcp_packet/congestion_control_feedback.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/loss_notification.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/rapid_resync_request.h"
#include "modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
#include "modules/rtp_rtcp/source/rtcp_packet/remb.h"
#include "modules/rtp_rtcp/source/rtcp_packet/remote_estimate.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/tmmbn.h"
#include "modules/rtp_rtcp/source/rtcp_packet/tmmbr.h"
#include "modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
#include "modules/rtp_rtcp/source/rtp_rtcp_config.h"
#include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h"
#include "modules/rtp_rtcp/source/tmmbr_help.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/time_utils.h"
#include "rtc_base/trace_event.h"
#include "system_wrappers/include/ntp_time.h"
namespace webrtc {
namespace {
CommonHeader;
ReportBlock;
constexpr int kRrTimeoutIntervals = …;
constexpr TimeDelta kTmmbrTimeoutInterval = …;
constexpr TimeDelta kMaxWarningLogInterval = …;
constexpr TimeDelta kRtcpMinFrameLength = …;
constexpr size_t kMaxNumberOfStoredRrtrs = …;
constexpr TimeDelta kDefaultVideoReportInterval = …;
constexpr TimeDelta kDefaultAudioReportInterval = …;
bool ResetTimestampIfExpired(const Timestamp now,
Timestamp& timestamp,
TimeDelta interval) { … }
}
constexpr size_t RTCPReceiver::RegisteredSsrcs::kMediaSsrcIndex;
RTCPReceiver::RegisteredSsrcs::RegisteredSsrcs(
bool disable_sequence_checker,
const RtpRtcpInterface::Configuration& config)
: … { … }
bool RTCPReceiver::RegisteredSsrcs::contains(uint32_t ssrc) const { … }
uint32_t RTCPReceiver::RegisteredSsrcs::media_ssrc() const { … }
void RTCPReceiver::RegisteredSsrcs::set_media_ssrc(uint32_t ssrc) { … }
struct RTCPReceiver::PacketInformation { … };
RTCPReceiver::RTCPReceiver(const RtpRtcpInterface::Configuration& config,
ModuleRtpRtcpImpl2* owner)
: … { … }
RTCPReceiver::RTCPReceiver(const RtpRtcpInterface::Configuration& config,
ModuleRtpRtcp* owner)
: … { … }
RTCPReceiver::~RTCPReceiver() { … }
void RTCPReceiver::IncomingPacket(rtc::ArrayView<const uint8_t> packet) { … }
int64_t RTCPReceiver::LastReceivedReportBlockMs() const { … }
void RTCPReceiver::SetRemoteSSRC(uint32_t ssrc) { … }
void RTCPReceiver::set_local_media_ssrc(uint32_t ssrc) { … }
uint32_t RTCPReceiver::local_media_ssrc() const { … }
uint32_t RTCPReceiver::RemoteSSRC() const { … }
void RTCPReceiver::RttStats::AddRtt(TimeDelta rtt) { … }
absl::optional<TimeDelta> RTCPReceiver::AverageRtt() const { … }
absl::optional<TimeDelta> RTCPReceiver::LastRtt() const { … }
RTCPReceiver::NonSenderRttStats RTCPReceiver::GetNonSenderRTT() const { … }
void RTCPReceiver::SetNonSenderRttMeasurement(bool enabled) { … }
absl::optional<TimeDelta> RTCPReceiver::GetAndResetXrRrRtt() { … }
absl::optional<TimeDelta> RTCPReceiver::OnPeriodicRttUpdate(
Timestamp newer_than,
bool sending) { … }
absl::optional<RtpRtcpInterface::SenderReportStats>
RTCPReceiver::GetSenderReportStats() const { … }
std::vector<rtcp::ReceiveTimeInfo>
RTCPReceiver::ConsumeReceivedXrReferenceTimeInfo() { … }
std::vector<ReportBlockData> RTCPReceiver::GetLatestReportBlockData() const { … }
bool RTCPReceiver::ParseCompoundPacket(rtc::ArrayView<const uint8_t> packet,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandleSenderReport(const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandleReceiverReport(const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
void RTCPReceiver::HandleReportBlock(const ReportBlock& report_block,
PacketInformation* packet_information,
uint32_t remote_ssrc) { … }
RTCPReceiver::TmmbrInformation* RTCPReceiver::FindOrCreateTmmbrInfo(
uint32_t remote_ssrc) { … }
void RTCPReceiver::UpdateTmmbrRemoteIsAlive(uint32_t remote_ssrc) { … }
RTCPReceiver::TmmbrInformation* RTCPReceiver::GetTmmbrInformation(
uint32_t remote_ssrc) { … }
bool RTCPReceiver::RtcpRrTimeout() { … }
bool RTCPReceiver::RtcpRrSequenceNumberTimeout() { … }
bool RTCPReceiver::UpdateTmmbrTimers() { … }
std::vector<rtcp::TmmbItem> RTCPReceiver::BoundingSet(bool* tmmbr_owner) { … }
bool RTCPReceiver::HandleSdes(const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandleNack(const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandleApp(const rtcp::CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandleBye(const CommonHeader& rtcp_block) { … }
bool RTCPReceiver::HandleXr(const CommonHeader& rtcp_block,
PacketInformation* packet_information,
bool& contains_dlrr,
uint32_t& ssrc) { … }
void RTCPReceiver::HandleXrReceiveReferenceTime(uint32_t sender_ssrc,
const rtcp::Rrtr& rrtr) { … }
void RTCPReceiver::HandleXrDlrrReportBlock(uint32_t sender_ssrc,
const rtcp::ReceiveTimeInfo& rti) { … }
void RTCPReceiver::HandleXrTargetBitrate(
uint32_t ssrc,
const rtcp::TargetBitrate& target_bitrate,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandlePli(const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandleTmmbr(const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandleTmmbn(const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandleSrReq(const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
void RTCPReceiver::HandlePsfbApp(const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandleFir(const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
void RTCPReceiver::HandleTransportFeedback(
const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
bool RTCPReceiver::HandleCongestionControlFeedback(
const CommonHeader& rtcp_block,
PacketInformation* packet_information) { … }
void RTCPReceiver::NotifyTmmbrUpdated() { … }
void RTCPReceiver::TriggerCallbacksFromRtcpPacket(
const PacketInformation& packet_information) { … }
std::vector<rtcp::TmmbItem> RTCPReceiver::TmmbrReceived() { … }
bool RTCPReceiver::RtcpRrTimeoutLocked(Timestamp now) { … }
bool RTCPReceiver::RtcpRrSequenceNumberTimeoutLocked(Timestamp now) { … }
}