Cleanup of deprecated RTPSender code
Also reformats RtpRtcpImpl::RtpSender by removing _ suffixes from struct members. Bug: webrtc:11036 Change-Id: I52cdcdff0727b62673323f64a6dc37d56ba4efbc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158532 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29642}
This commit is contained in:
parent
cb30726646
commit
9cdc9cc1c4
@ -40,13 +40,13 @@ const int64_t kDefaultExpectedRetransmissionTimeMs = 125;
|
||||
|
||||
ModuleRtpRtcpImpl::RtpSenderContext::RtpSenderContext(
|
||||
const RtpRtcp::Configuration& config)
|
||||
: packet_history_(config.clock),
|
||||
packet_sender_(config, &packet_history_),
|
||||
non_paced_sender_(&packet_sender_),
|
||||
packet_generator_(
|
||||
: packet_history(config.clock),
|
||||
packet_sender(config, &packet_history),
|
||||
non_paced_sender(&packet_sender),
|
||||
packet_generator(
|
||||
config,
|
||||
&packet_history_,
|
||||
config.paced_sender ? config.paced_sender : &non_paced_sender_) {}
|
||||
&packet_history,
|
||||
config.paced_sender ? config.paced_sender : &non_paced_sender) {}
|
||||
|
||||
RtpRtcp::Configuration::Configuration() = default;
|
||||
RtpRtcp::Configuration::Configuration(Configuration&& rhs) = default;
|
||||
@ -75,7 +75,7 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
|
||||
rtp_sender_ = std::make_unique<RtpSenderContext>(configuration);
|
||||
// Make sure rtcp sender use same timestamp offset as rtp sender.
|
||||
rtcp_sender_.SetTimestampOffset(
|
||||
rtp_sender_->packet_generator_.TimestampOffset());
|
||||
rtp_sender_->packet_generator.TimestampOffset());
|
||||
}
|
||||
|
||||
// Set default packet size limit.
|
||||
@ -101,7 +101,7 @@ void ModuleRtpRtcpImpl::Process() {
|
||||
|
||||
if (rtp_sender_) {
|
||||
if (now >= last_bitrate_process_time_ + kRtpRtcpBitrateProcessTimeMs) {
|
||||
rtp_sender_->packet_sender_.ProcessBitrateAndNotifyObservers();
|
||||
rtp_sender_->packet_sender.ProcessBitrateAndNotifyObservers();
|
||||
last_bitrate_process_time_ = now;
|
||||
next_process_time_ =
|
||||
std::min(next_process_time_, now + kRtpRtcpBitrateProcessTimeMs);
|
||||
@ -179,26 +179,26 @@ void ModuleRtpRtcpImpl::Process() {
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) {
|
||||
rtp_sender_->packet_generator_.SetRtxStatus(mode);
|
||||
rtp_sender_->packet_generator.SetRtxStatus(mode);
|
||||
}
|
||||
|
||||
int ModuleRtpRtcpImpl::RtxSendStatus() const {
|
||||
return rtp_sender_ ? rtp_sender_->packet_generator_.RtxStatus() : kRtxOff;
|
||||
return rtp_sender_ ? rtp_sender_->packet_generator.RtxStatus() : kRtxOff;
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::SetRtxSendPayloadType(int payload_type,
|
||||
int associated_payload_type) {
|
||||
rtp_sender_->packet_generator_.SetRtxPayloadType(payload_type,
|
||||
associated_payload_type);
|
||||
rtp_sender_->packet_generator.SetRtxPayloadType(payload_type,
|
||||
associated_payload_type);
|
||||
}
|
||||
|
||||
absl::optional<uint32_t> ModuleRtpRtcpImpl::RtxSsrc() const {
|
||||
return rtp_sender_ ? rtp_sender_->packet_generator_.RtxSsrc() : absl::nullopt;
|
||||
return rtp_sender_ ? rtp_sender_->packet_generator.RtxSsrc() : absl::nullopt;
|
||||
}
|
||||
|
||||
absl::optional<uint32_t> ModuleRtpRtcpImpl::FlexfecSsrc() const {
|
||||
if (rtp_sender_) {
|
||||
return rtp_sender_->packet_generator_.FlexfecSsrc();
|
||||
return rtp_sender_->packet_generator.FlexfecSsrc();
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
@ -218,54 +218,53 @@ int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) {
|
||||
}
|
||||
|
||||
uint32_t ModuleRtpRtcpImpl::StartTimestamp() const {
|
||||
return rtp_sender_->packet_generator_.TimestampOffset();
|
||||
return rtp_sender_->packet_generator.TimestampOffset();
|
||||
}
|
||||
|
||||
// Configure start timestamp, default is a random number.
|
||||
void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) {
|
||||
rtcp_sender_.SetTimestampOffset(timestamp);
|
||||
rtp_sender_->packet_generator_.SetTimestampOffset(timestamp);
|
||||
rtp_sender_->packet_generator.SetTimestampOffset(timestamp);
|
||||
}
|
||||
|
||||
uint16_t ModuleRtpRtcpImpl::SequenceNumber() const {
|
||||
return rtp_sender_->packet_generator_.SequenceNumber();
|
||||
return rtp_sender_->packet_generator.SequenceNumber();
|
||||
}
|
||||
|
||||
// Set SequenceNumber, default is a random number.
|
||||
void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) {
|
||||
rtp_sender_->packet_generator_.SetSequenceNumber(seq_num);
|
||||
rtp_sender_->packet_generator.SetSequenceNumber(seq_num);
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) {
|
||||
rtp_sender_->packet_generator_.SetRtpState(rtp_state);
|
||||
rtp_sender_->packet_sender_.SetMediaHasBeenSent(
|
||||
rtp_state.media_has_been_sent);
|
||||
rtp_sender_->packet_generator.SetRtpState(rtp_state);
|
||||
rtp_sender_->packet_sender.SetMediaHasBeenSent(rtp_state.media_has_been_sent);
|
||||
rtcp_sender_.SetTimestampOffset(rtp_state.start_timestamp);
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) {
|
||||
rtp_sender_->packet_generator_.SetRtxRtpState(rtp_state);
|
||||
rtp_sender_->packet_generator.SetRtxRtpState(rtp_state);
|
||||
}
|
||||
|
||||
RtpState ModuleRtpRtcpImpl::GetRtpState() const {
|
||||
RtpState state = rtp_sender_->packet_generator_.GetRtpState();
|
||||
state.media_has_been_sent = rtp_sender_->packet_sender_.MediaHasBeenSent();
|
||||
RtpState state = rtp_sender_->packet_generator.GetRtpState();
|
||||
state.media_has_been_sent = rtp_sender_->packet_sender.MediaHasBeenSent();
|
||||
return state;
|
||||
}
|
||||
|
||||
RtpState ModuleRtpRtcpImpl::GetRtxState() const {
|
||||
return rtp_sender_->packet_generator_.GetRtxRtpState();
|
||||
return rtp_sender_->packet_generator.GetRtxRtpState();
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::SetRid(const std::string& rid) {
|
||||
if (rtp_sender_) {
|
||||
rtp_sender_->packet_generator_.SetRid(rid);
|
||||
rtp_sender_->packet_generator.SetRid(rid);
|
||||
}
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::SetMid(const std::string& mid) {
|
||||
if (rtp_sender_) {
|
||||
rtp_sender_->packet_generator_.SetMid(mid);
|
||||
rtp_sender_->packet_generator.SetMid(mid);
|
||||
}
|
||||
// TODO(bugs.webrtc.org/4050): If we end up supporting the MID SDES item for
|
||||
// RTCP, this will need to be passed down to the RTCPSender also.
|
||||
@ -273,7 +272,7 @@ void ModuleRtpRtcpImpl::SetMid(const std::string& mid) {
|
||||
|
||||
void ModuleRtpRtcpImpl::SetCsrcs(const std::vector<uint32_t>& csrcs) {
|
||||
rtcp_sender_.SetCsrcs(csrcs);
|
||||
rtp_sender_->packet_generator_.SetCsrcs(csrcs);
|
||||
rtp_sender_->packet_generator.SetCsrcs(csrcs);
|
||||
}
|
||||
|
||||
// TODO(pbos): Handle media and RTX streams separately (separate RTCP
|
||||
@ -285,13 +284,13 @@ RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() {
|
||||
if (rtp_sender_) {
|
||||
StreamDataCounters rtp_stats;
|
||||
StreamDataCounters rtx_stats;
|
||||
rtp_sender_->packet_sender_.GetDataCounters(&rtp_stats, &rtx_stats);
|
||||
rtp_sender_->packet_sender.GetDataCounters(&rtp_stats, &rtx_stats);
|
||||
state.packets_sent =
|
||||
rtp_stats.transmitted.packets + rtx_stats.transmitted.packets;
|
||||
state.media_bytes_sent = rtp_stats.transmitted.payload_bytes +
|
||||
rtx_stats.transmitted.payload_bytes;
|
||||
state.send_bitrate =
|
||||
rtp_sender_->packet_sender_.SendBitrate().bps<uint32_t>();
|
||||
rtp_sender_->packet_sender.SendBitrate().bps<uint32_t>();
|
||||
}
|
||||
state.module = this;
|
||||
|
||||
@ -325,19 +324,19 @@ bool ModuleRtpRtcpImpl::Sending() const {
|
||||
// updated.
|
||||
void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) {
|
||||
if (rtp_sender_) {
|
||||
rtp_sender_->packet_generator_.SetSendingMediaStatus(sending);
|
||||
rtp_sender_->packet_generator.SetSendingMediaStatus(sending);
|
||||
} else {
|
||||
RTC_DCHECK(!sending);
|
||||
}
|
||||
}
|
||||
|
||||
bool ModuleRtpRtcpImpl::SendingMedia() const {
|
||||
return rtp_sender_ ? rtp_sender_->packet_generator_.SendingMedia() : false;
|
||||
return rtp_sender_ ? rtp_sender_->packet_generator.SendingMedia() : false;
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::SetAsPartOfAllocation(bool part_of_allocation) {
|
||||
RTC_CHECK(rtp_sender_);
|
||||
rtp_sender_->packet_sender_.ForceIncludeSendPacketsInAllocation(
|
||||
rtp_sender_->packet_sender.ForceIncludeSendPacketsInAllocation(
|
||||
part_of_allocation);
|
||||
}
|
||||
|
||||
@ -360,39 +359,39 @@ bool ModuleRtpRtcpImpl::TrySendPacket(RtpPacketToSend* packet,
|
||||
const PacedPacketInfo& pacing_info) {
|
||||
RTC_DCHECK(rtp_sender_);
|
||||
// TODO(sprang): Consider if we can remove this check.
|
||||
if (!rtp_sender_->packet_generator_.SendingMedia()) {
|
||||
if (!rtp_sender_->packet_generator.SendingMedia()) {
|
||||
return false;
|
||||
}
|
||||
rtp_sender_->packet_sender_.SendPacket(packet, pacing_info);
|
||||
rtp_sender_->packet_sender.SendPacket(packet, pacing_info);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::OnPacketsAcknowledged(
|
||||
rtc::ArrayView<const uint16_t> sequence_numbers) {
|
||||
RTC_DCHECK(rtp_sender_);
|
||||
rtp_sender_->packet_history_.CullAcknowledgedPackets(sequence_numbers);
|
||||
rtp_sender_->packet_history.CullAcknowledgedPackets(sequence_numbers);
|
||||
}
|
||||
|
||||
bool ModuleRtpRtcpImpl::SupportsPadding() const {
|
||||
RTC_DCHECK(rtp_sender_);
|
||||
return rtp_sender_->packet_generator_.SupportsPadding();
|
||||
return rtp_sender_->packet_generator.SupportsPadding();
|
||||
}
|
||||
|
||||
bool ModuleRtpRtcpImpl::SupportsRtxPayloadPadding() const {
|
||||
RTC_DCHECK(rtp_sender_);
|
||||
return rtp_sender_->packet_generator_.SupportsRtxPayloadPadding();
|
||||
return rtp_sender_->packet_generator.SupportsRtxPayloadPadding();
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<RtpPacketToSend>>
|
||||
ModuleRtpRtcpImpl::GeneratePadding(size_t target_size_bytes) {
|
||||
RTC_DCHECK(rtp_sender_);
|
||||
return rtp_sender_->packet_generator_.GeneratePadding(
|
||||
target_size_bytes, rtp_sender_->packet_sender_.MediaHasBeenSent());
|
||||
return rtp_sender_->packet_generator.GeneratePadding(
|
||||
target_size_bytes, rtp_sender_->packet_sender.MediaHasBeenSent());
|
||||
}
|
||||
|
||||
size_t ModuleRtpRtcpImpl::MaxRtpPacketSize() const {
|
||||
RTC_DCHECK(rtp_sender_);
|
||||
return rtp_sender_->packet_generator_.MaxRtpPacketSize();
|
||||
return rtp_sender_->packet_generator.MaxRtpPacketSize();
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::SetMaxRtpPacketSize(size_t rtp_packet_size) {
|
||||
@ -403,7 +402,7 @@ void ModuleRtpRtcpImpl::SetMaxRtpPacketSize(size_t rtp_packet_size) {
|
||||
|
||||
rtcp_sender_.SetMaxRtpPacketSize(rtp_packet_size);
|
||||
if (rtp_sender_) {
|
||||
rtp_sender_->packet_generator_.SetMaxRtpPacketSize(rtp_packet_size);
|
||||
rtp_sender_->packet_generator.SetMaxRtpPacketSize(rtp_packet_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -502,7 +501,7 @@ int32_t ModuleRtpRtcpImpl::DataCountersRTP(size_t* bytes_sent,
|
||||
uint32_t* packets_sent) const {
|
||||
StreamDataCounters rtp_stats;
|
||||
StreamDataCounters rtx_stats;
|
||||
rtp_sender_->packet_sender_.GetDataCounters(&rtp_stats, &rtx_stats);
|
||||
rtp_sender_->packet_sender.GetDataCounters(&rtp_stats, &rtx_stats);
|
||||
|
||||
if (bytes_sent) {
|
||||
// TODO(http://crbug.com/webrtc/10525): Bytes sent should only include
|
||||
@ -524,7 +523,7 @@ int32_t ModuleRtpRtcpImpl::DataCountersRTP(size_t* bytes_sent,
|
||||
void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
|
||||
StreamDataCounters* rtp_counters,
|
||||
StreamDataCounters* rtx_counters) const {
|
||||
rtp_sender_->packet_sender_.GetDataCounters(rtp_counters, rtx_counters);
|
||||
rtp_sender_->packet_sender.GetDataCounters(rtp_counters, rtx_counters);
|
||||
}
|
||||
|
||||
// Received RTCP report.
|
||||
@ -549,29 +548,29 @@ void ModuleRtpRtcpImpl::UnsetRemb() {
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::SetExtmapAllowMixed(bool extmap_allow_mixed) {
|
||||
rtp_sender_->packet_generator_.SetExtmapAllowMixed(extmap_allow_mixed);
|
||||
rtp_sender_->packet_generator.SetExtmapAllowMixed(extmap_allow_mixed);
|
||||
}
|
||||
|
||||
int32_t ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension(
|
||||
const RTPExtensionType type,
|
||||
const uint8_t id) {
|
||||
return rtp_sender_->packet_generator_.RegisterRtpHeaderExtension(type, id);
|
||||
return rtp_sender_->packet_generator.RegisterRtpHeaderExtension(type, id);
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::RegisterRtpHeaderExtension(absl::string_view uri,
|
||||
int id) {
|
||||
bool registered =
|
||||
rtp_sender_->packet_generator_.RegisterRtpHeaderExtension(uri, id);
|
||||
rtp_sender_->packet_generator.RegisterRtpHeaderExtension(uri, id);
|
||||
RTC_CHECK(registered);
|
||||
}
|
||||
|
||||
int32_t ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension(
|
||||
const RTPExtensionType type) {
|
||||
return rtp_sender_->packet_generator_.DeregisterRtpHeaderExtension(type);
|
||||
return rtp_sender_->packet_generator.DeregisterRtpHeaderExtension(type);
|
||||
}
|
||||
void ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension(
|
||||
absl::string_view uri) {
|
||||
rtp_sender_->packet_generator_.DeregisterRtpHeaderExtension(uri);
|
||||
rtp_sender_->packet_generator.DeregisterRtpHeaderExtension(uri);
|
||||
}
|
||||
|
||||
// (TMMBR) Temporary Max Media Bit Rate.
|
||||
@ -648,14 +647,14 @@ bool ModuleRtpRtcpImpl::TimeToSendFullNackList(int64_t now) const {
|
||||
// Store the sent packets, needed to answer to Negative acknowledgment requests.
|
||||
void ModuleRtpRtcpImpl::SetStorePacketsStatus(const bool enable,
|
||||
const uint16_t number_to_store) {
|
||||
rtp_sender_->packet_history_.SetStorePacketsStatus(
|
||||
rtp_sender_->packet_history.SetStorePacketsStatus(
|
||||
enable ? RtpPacketHistory::StorageMode::kStoreAndCull
|
||||
: RtpPacketHistory::StorageMode::kDisabled,
|
||||
number_to_store);
|
||||
}
|
||||
|
||||
bool ModuleRtpRtcpImpl::StorePackets() const {
|
||||
return rtp_sender_->packet_history_.GetStorageMode() !=
|
||||
return rtp_sender_->packet_history.GetStorageMode() !=
|
||||
RtpPacketHistory::StorageMode::kDisabled;
|
||||
}
|
||||
|
||||
@ -702,12 +701,12 @@ void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate,
|
||||
uint32_t* video_rate,
|
||||
uint32_t* fec_rate,
|
||||
uint32_t* nack_rate) const {
|
||||
*total_rate = rtp_sender_->packet_sender_.SendBitrate().bps<uint32_t>();
|
||||
*total_rate = rtp_sender_->packet_sender.SendBitrate().bps<uint32_t>();
|
||||
if (video_rate)
|
||||
*video_rate = 0;
|
||||
if (fec_rate)
|
||||
*fec_rate = 0;
|
||||
*nack_rate = rtp_sender_->packet_sender_.NackOverheadRate().bps<uint32_t>();
|
||||
*nack_rate = rtp_sender_->packet_sender.NackOverheadRate().bps<uint32_t>();
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::OnRequestSendReport() {
|
||||
@ -727,7 +726,7 @@ void ModuleRtpRtcpImpl::OnReceivedNack(
|
||||
if (rtt == 0) {
|
||||
rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL);
|
||||
}
|
||||
rtp_sender_->packet_generator_.OnReceivedNack(nack_sequence_numbers, rtt);
|
||||
rtp_sender_->packet_generator.OnReceivedNack(nack_sequence_numbers, rtt);
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks(
|
||||
@ -735,18 +734,18 @@ void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks(
|
||||
if (ack_observer_) {
|
||||
uint32_t ssrc = SSRC();
|
||||
absl::optional<uint32_t> rtx_ssrc;
|
||||
if (rtp_sender_->packet_generator_.RtxStatus() != kRtxOff) {
|
||||
rtx_ssrc = rtp_sender_->packet_generator_.RtxSsrc();
|
||||
if (rtp_sender_->packet_generator.RtxStatus() != kRtxOff) {
|
||||
rtx_ssrc = rtp_sender_->packet_generator.RtxSsrc();
|
||||
}
|
||||
|
||||
for (const RTCPReportBlock& report_block : report_blocks) {
|
||||
if (ssrc == report_block.source_ssrc) {
|
||||
rtp_sender_->packet_generator_.OnReceivedAckOnSsrc(
|
||||
rtp_sender_->packet_generator.OnReceivedAckOnSsrc(
|
||||
report_block.extended_highest_sequence_number);
|
||||
ack_observer_->OnReceivedAck(
|
||||
report_block.extended_highest_sequence_number);
|
||||
} else if (rtx_ssrc && *rtx_ssrc == report_block.source_ssrc) {
|
||||
rtp_sender_->packet_generator_.OnReceivedAckOnRtxSsrc(
|
||||
rtp_sender_->packet_generator.OnReceivedAckOnRtxSsrc(
|
||||
report_block.extended_highest_sequence_number);
|
||||
}
|
||||
}
|
||||
@ -779,7 +778,7 @@ void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) {
|
||||
rtc::CritScope cs(&critical_section_rtt_);
|
||||
rtt_ms_ = rtt_ms;
|
||||
if (rtp_sender_) {
|
||||
rtp_sender_->packet_history_.SetRtt(rtt_ms);
|
||||
rtp_sender_->packet_history.SetRtt(rtt_ms);
|
||||
}
|
||||
}
|
||||
|
||||
@ -794,21 +793,21 @@ void ModuleRtpRtcpImpl::SetVideoBitrateAllocation(
|
||||
}
|
||||
|
||||
RTPSender* ModuleRtpRtcpImpl::RtpSender() {
|
||||
return rtp_sender_ ? &rtp_sender_->packet_generator_ : nullptr;
|
||||
return rtp_sender_ ? &rtp_sender_->packet_generator : nullptr;
|
||||
}
|
||||
|
||||
const RTPSender* ModuleRtpRtcpImpl::RtpSender() const {
|
||||
return rtp_sender_ ? &rtp_sender_->packet_generator_ : nullptr;
|
||||
return rtp_sender_ ? &rtp_sender_->packet_generator : nullptr;
|
||||
}
|
||||
|
||||
DataRate ModuleRtpRtcpImpl::SendRate() const {
|
||||
RTC_DCHECK(rtp_sender_);
|
||||
return rtp_sender_->packet_sender_.SendBitrate();
|
||||
return rtp_sender_->packet_sender.SendBitrate();
|
||||
}
|
||||
|
||||
DataRate ModuleRtpRtcpImpl::NackOverheadRate() const {
|
||||
RTC_DCHECK(rtp_sender_);
|
||||
return rtp_sender_->packet_sender_.NackOverheadRate();
|
||||
return rtp_sender_->packet_sender.NackOverheadRate();
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -281,10 +281,10 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
|
||||
bool UpdateRTCPReceiveInformationTimers();
|
||||
|
||||
RTPSender* rtp_sender() {
|
||||
return rtp_sender_ ? &rtp_sender_->packet_generator_ : nullptr;
|
||||
return rtp_sender_ ? &rtp_sender_->packet_generator : nullptr;
|
||||
}
|
||||
const RTPSender* rtp_sender() const {
|
||||
return rtp_sender_ ? &rtp_sender_->packet_generator_ : nullptr;
|
||||
return rtp_sender_ ? &rtp_sender_->packet_generator : nullptr;
|
||||
}
|
||||
|
||||
RTCPSender* rtcp_sender() { return &rtcp_sender_; }
|
||||
@ -305,14 +305,14 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
|
||||
struct RtpSenderContext {
|
||||
explicit RtpSenderContext(const RtpRtcp::Configuration& config);
|
||||
// Storage of packets, for retransmissions and padding, if applicable.
|
||||
RtpPacketHistory packet_history_;
|
||||
RtpPacketHistory packet_history;
|
||||
// Handles final time timestamping/stats/etc and handover to Transport.
|
||||
RtpSenderEgress packet_sender_;
|
||||
RtpSenderEgress packet_sender;
|
||||
// If no paced sender configured, this class will be used to pass packets
|
||||
// from |packet_generator_| to |packet_sender_|.
|
||||
RtpSenderEgress::NonPacedPacketSender non_paced_sender_;
|
||||
RtpSenderEgress::NonPacedPacketSender non_paced_sender;
|
||||
// Handles creation of RTP packets to be sent.
|
||||
RTPSender packet_generator_;
|
||||
RTPSender packet_generator;
|
||||
};
|
||||
|
||||
void set_rtt_ms(int64_t rtt_ms);
|
||||
|
||||
@ -93,8 +93,6 @@ bool HasBweExtension(const RtpHeaderExtensionMap& extensions_map) {
|
||||
|
||||
} // namespace
|
||||
|
||||
RTPSender::RTPSender(const RtpRtcp::Configuration& config)
|
||||
: RTPSender(config, nullptr, config.paced_sender) {}
|
||||
RTPSender::RTPSender(const RtpRtcp::Configuration& config,
|
||||
RtpPacketHistory* packet_history,
|
||||
RtpPacketSender* packet_sender)
|
||||
@ -106,6 +104,8 @@ RTPSender::RTPSender(const RtpRtcp::Configuration& config,
|
||||
flexfec_ssrc_(config.flexfec_sender
|
||||
? absl::make_optional(config.flexfec_sender->ssrc())
|
||||
: absl::nullopt),
|
||||
packet_history_(packet_history),
|
||||
paced_sender_(packet_sender),
|
||||
sending_media_(true), // Default to sending media.
|
||||
max_packet_size_(IP_PACKET_SIZE - 28), // Default is IP-v4/UDP.
|
||||
last_payload_type_(-1),
|
||||
@ -128,27 +128,6 @@ RTPSender::RTPSender(const RtpRtcp::Configuration& config,
|
||||
sequence_number_rtx_ = random_.Rand(1, kMaxInitRtpSeqNumber);
|
||||
sequence_number_ = random_.Rand(1, kMaxInitRtpSeqNumber);
|
||||
|
||||
if (packet_history == nullptr) {
|
||||
// Packet history must be provided if using the new split sender, so if it
|
||||
// is nullptr it means we are in backwards compatibility mode where
|
||||
// RTPSender owns the history, RtpSenderEgress and non-paced sender adapter.
|
||||
// TODO(bugs.webrtc.org/11036): Remove.
|
||||
owned_history_ = std::make_unique<RtpPacketHistory>(clock_);
|
||||
packet_history_ = owned_history_.get();
|
||||
egress_ = std::make_unique<RtpSenderEgress>(config, packet_history_);
|
||||
if (packet_sender) {
|
||||
paced_sender_ = packet_sender;
|
||||
} else {
|
||||
non_paced_packet_sender_ =
|
||||
std::make_unique<RtpSenderEgress::NonPacedPacketSender>(
|
||||
egress_.get());
|
||||
paced_sender_ = non_paced_packet_sender_.get();
|
||||
}
|
||||
} else {
|
||||
packet_history_ = packet_history;
|
||||
paced_sender_ = packet_sender;
|
||||
}
|
||||
|
||||
RTC_DCHECK(paced_sender_);
|
||||
RTC_DCHECK(packet_history_);
|
||||
}
|
||||
@ -175,16 +154,6 @@ rtc::ArrayView<const RtpExtensionSize> RTPSender::VideoExtensionSizes() {
|
||||
arraysize(kVideoExtensionSizes));
|
||||
}
|
||||
|
||||
uint16_t RTPSender::ActualSendBitrateKbit() const {
|
||||
RTC_DCHECK(egress_);
|
||||
return egress_->SendBitrate().kbps<uint16_t>();
|
||||
}
|
||||
|
||||
uint32_t RTPSender::NackOverheadRate() const {
|
||||
RTC_DCHECK(egress_);
|
||||
return egress_->NackOverheadRate().bps<uint32_t>();
|
||||
}
|
||||
|
||||
void RTPSender::SetExtmapAllowMixed(bool extmap_allow_mixed) {
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
rtp_header_extension_map_.SetExtmapAllowMixed(extmap_allow_mixed);
|
||||
@ -257,18 +226,6 @@ void RTPSender::SetRtxPayloadType(int payload_type,
|
||||
rtx_payload_type_map_[associated_payload_type] = payload_type;
|
||||
}
|
||||
|
||||
void RTPSender::SetStorePacketsStatus(bool enable, uint16_t number_to_store) {
|
||||
packet_history_->SetStorePacketsStatus(
|
||||
enable ? RtpPacketHistory::StorageMode::kStoreAndCull
|
||||
: RtpPacketHistory::StorageMode::kDisabled,
|
||||
number_to_store);
|
||||
}
|
||||
|
||||
bool RTPSender::StorePackets() const {
|
||||
return packet_history_->GetStorageMode() !=
|
||||
RtpPacketHistory::StorageMode::kDisabled;
|
||||
}
|
||||
|
||||
int32_t RTPSender::ReSendPacket(uint16_t packet_id) {
|
||||
// Try to find packet in RTP packet history. Also verify RTT here, so that we
|
||||
// don't retransmit too often.
|
||||
@ -342,23 +299,6 @@ void RTPSender::OnReceivedNack(
|
||||
}
|
||||
}
|
||||
|
||||
// Called from pacer when we can send the packet.
|
||||
bool RTPSender::TrySendPacket(RtpPacketToSend* packet,
|
||||
const PacedPacketInfo& pacing_info) {
|
||||
RTC_DCHECK(packet);
|
||||
|
||||
{
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
if (!sending_media_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
RTC_DCHECK(egress_);
|
||||
egress_->SendPacket(packet, pacing_info);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RTPSender::SupportsPadding() const {
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
return sending_media_ && supports_bwe_extension_;
|
||||
@ -370,12 +310,6 @@ bool RTPSender::SupportsRtxPayloadPadding() const {
|
||||
(rtx_ & kRtxRedundantPayloads);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<RtpPacketToSend>> RTPSender::GeneratePadding(
|
||||
size_t target_size_bytes) {
|
||||
RTC_DCHECK(egress_);
|
||||
return GeneratePadding(target_size_bytes, egress_->MediaHasBeenSent());
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<RtpPacketToSend>> RTPSender::GeneratePadding(
|
||||
size_t target_size_bytes,
|
||||
bool media_has_been_sent) {
|
||||
@ -525,11 +459,6 @@ void RTPSender::EnqueuePackets(
|
||||
paced_sender_->EnqueuePackets(std::move(packets));
|
||||
}
|
||||
|
||||
void RTPSender::ProcessBitrate() {
|
||||
RTC_DCHECK(egress_);
|
||||
egress_->ProcessBitrateAndNotifyObservers();
|
||||
}
|
||||
|
||||
size_t RTPSender::RtpHeaderLength() const {
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
size_t rtp_header_length = kRtpHeaderLength;
|
||||
@ -546,12 +475,6 @@ uint16_t RTPSender::AllocateSequenceNumber(uint16_t packets_to_send) {
|
||||
return first_allocated_sequence_number;
|
||||
}
|
||||
|
||||
void RTPSender::GetDataCounters(StreamDataCounters* rtp_stats,
|
||||
StreamDataCounters* rtx_stats) const {
|
||||
RTC_DCHECK(egress_);
|
||||
egress_->GetDataCounters(rtp_stats, rtx_stats);
|
||||
}
|
||||
|
||||
std::unique_ptr<RtpPacketToSend> RTPSender::AllocatePacket() const {
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
// TODO(danilchap): Find better motivator and value for extra capacity.
|
||||
@ -621,11 +544,6 @@ bool RTPSender::SendingMedia() const {
|
||||
return sending_media_;
|
||||
}
|
||||
|
||||
void RTPSender::SetAsPartOfAllocation(bool part_of_allocation) {
|
||||
RTC_DCHECK(egress_);
|
||||
egress_->ForceIncludeSendPacketsInAllocation(part_of_allocation);
|
||||
}
|
||||
|
||||
void RTPSender::SetTimestampOffset(uint32_t timestamp) {
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
timestamp_offset_ = timestamp;
|
||||
@ -798,11 +716,6 @@ std::unique_ptr<RtpPacketToSend> RTPSender::BuildRtxPacket(
|
||||
return rtx_packet;
|
||||
}
|
||||
|
||||
uint32_t RTPSender::BitrateSent() const {
|
||||
RTC_DCHECK(egress_);
|
||||
return egress_->SendBitrate().bps<uint32_t>();
|
||||
}
|
||||
|
||||
void RTPSender::SetRtpState(const RtpState& rtp_state) {
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
sequence_number_ = rtp_state.sequence_number;
|
||||
@ -812,9 +725,6 @@ void RTPSender::SetRtpState(const RtpState& rtp_state) {
|
||||
capture_time_ms_ = rtp_state.capture_time_ms;
|
||||
last_timestamp_time_ms_ = rtp_state.last_timestamp_time_ms;
|
||||
ssrc_has_acked_ = rtp_state.ssrc_has_acked;
|
||||
if (egress_) {
|
||||
egress_->SetMediaHasBeenSent(rtp_state.media_has_been_sent);
|
||||
}
|
||||
}
|
||||
|
||||
RtpState RTPSender::GetRtpState() const {
|
||||
@ -827,10 +737,6 @@ RtpState RTPSender::GetRtpState() const {
|
||||
state.capture_time_ms = capture_time_ms_;
|
||||
state.last_timestamp_time_ms = last_timestamp_time_ms_;
|
||||
state.ssrc_has_acked = ssrc_has_acked_;
|
||||
if (egress_) {
|
||||
state.media_has_been_sent = egress_->MediaHasBeenSent();
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -855,13 +761,4 @@ int64_t RTPSender::LastTimestampTimeMs() const {
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
return last_timestamp_time_ms_;
|
||||
}
|
||||
|
||||
void RTPSender::SetRtt(int64_t rtt_ms) {
|
||||
packet_history_->SetRtt(rtt_ms);
|
||||
}
|
||||
|
||||
void RTPSender::OnPacketsAcknowledged(
|
||||
rtc::ArrayView<const uint16_t> sequence_numbers) {
|
||||
packet_history_->CullAcknowledgedPackets(sequence_numbers);
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_packet_history.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_rtcp_config.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_sender_egress.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
#include "rtc_base/critical_section.h"
|
||||
#include "rtc_base/deprecation.h"
|
||||
@ -50,23 +49,12 @@ class RTPSender {
|
||||
RTPSender(const RtpRtcp::Configuration& config,
|
||||
RtpPacketHistory* packet_history,
|
||||
RtpPacketSender* packet_sender);
|
||||
explicit RTPSender(const RtpRtcp::Configuration& config);
|
||||
|
||||
~RTPSender();
|
||||
|
||||
// TODO(bugs.webrtc.org/11036): Remove.
|
||||
void ProcessBitrate();
|
||||
uint16_t ActualSendBitrateKbit() const;
|
||||
uint32_t NackOverheadRate() const;
|
||||
|
||||
void SetSendingMediaStatus(bool enabled);
|
||||
bool SendingMedia() const;
|
||||
|
||||
// TODO(bugs.webrtc.org/11036): Remove.
|
||||
void SetAsPartOfAllocation(bool part_of_allocation);
|
||||
void GetDataCounters(StreamDataCounters* rtp_stats,
|
||||
StreamDataCounters* rtx_stats) const;
|
||||
|
||||
uint32_t TimestampOffset() const;
|
||||
void SetTimestampOffset(uint32_t timestamp);
|
||||
|
||||
@ -90,20 +78,9 @@ class RTPSender {
|
||||
int32_t DeregisterRtpHeaderExtension(RTPExtensionType type);
|
||||
void DeregisterRtpHeaderExtension(absl::string_view uri);
|
||||
|
||||
// Tries to send packet to transport. Also updates any timing extensions,
|
||||
// calls observers waiting for packet send events, and updates stats.
|
||||
// Returns true if packet belongs to this RTP module, false otherwise.
|
||||
// TODO(bugs.webrtc.org/11036): Remove.
|
||||
bool TrySendPacket(RtpPacketToSend* packet,
|
||||
const PacedPacketInfo& pacing_info);
|
||||
|
||||
bool SupportsPadding() const;
|
||||
bool SupportsRtxPayloadPadding() const;
|
||||
|
||||
// TODO(bugs.webrtc.org/11036): Remove.
|
||||
std::vector<std::unique_ptr<RtpPacketToSend>> GeneratePadding(
|
||||
size_t target_size_bytes);
|
||||
|
||||
std::vector<std::unique_ptr<RtpPacketToSend>> GeneratePadding(
|
||||
size_t target_size_bytes,
|
||||
bool media_has_been_sent);
|
||||
@ -112,10 +89,6 @@ class RTPSender {
|
||||
void OnReceivedNack(const std::vector<uint16_t>& nack_sequence_numbers,
|
||||
int64_t avg_rtt);
|
||||
|
||||
void SetStorePacketsStatus(bool enable, uint16_t number_to_store);
|
||||
|
||||
bool StorePackets() const;
|
||||
|
||||
int32_t ReSendPacket(uint16_t packet_id);
|
||||
|
||||
// ACK.
|
||||
@ -161,9 +134,6 @@ class RTPSender {
|
||||
// sending to the network.
|
||||
void EnqueuePackets(std::vector<std::unique_ptr<RtpPacketToSend>> packets);
|
||||
|
||||
// TODO(bugs.webrtc.org/11036): Remove.
|
||||
uint32_t BitrateSent() const;
|
||||
|
||||
void SetRtpState(const RtpState& rtp_state);
|
||||
RtpState GetRtpState() const;
|
||||
void SetRtxRtpState(const RtpState& rtp_state);
|
||||
@ -171,10 +141,6 @@ class RTPSender {
|
||||
|
||||
int64_t LastTimestampTimeMs() const;
|
||||
|
||||
// TODO(bugs.webrtc.org/11036): Remove.
|
||||
void SetRtt(int64_t rtt_ms);
|
||||
void OnPacketsAcknowledged(rtc::ArrayView<const uint16_t> sequence_numbers);
|
||||
|
||||
private:
|
||||
std::unique_ptr<RtpPacketToSend> BuildRtxPacket(
|
||||
const RtpPacketToSend& packet);
|
||||
@ -190,17 +156,8 @@ class RTPSender {
|
||||
const absl::optional<uint32_t> rtx_ssrc_;
|
||||
const absl::optional<uint32_t> flexfec_ssrc_;
|
||||
|
||||
// TODO(bugs.webrtc.org/11036): Remove |owned_history_|, make
|
||||
// |packet_history_| ptr const.
|
||||
std::unique_ptr<RtpPacketHistory> owned_history_;
|
||||
RtpPacketHistory* packet_history_;
|
||||
|
||||
// TODO(bugs.webrtc.org/11036): Remove |egress_| and |non_paced_sender_|,
|
||||
// make |paced_sender_| ptr const.
|
||||
std::unique_ptr<RtpSenderEgress> egress_;
|
||||
std::unique_ptr<RtpSenderEgress::NonPacedPacketSender>
|
||||
non_paced_packet_sender_;
|
||||
RtpPacketSender* paced_sender_;
|
||||
RtpPacketHistory* const packet_history_;
|
||||
RtpPacketSender* const paced_sender_;
|
||||
|
||||
rtc::CriticalSection send_critsect_;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user