Add is_fec property to RtpPacketToSend
Use instead of checking the packet's payload type and ssrc. Bug: webrtc:7135 Change-Id: I272922a7879ef3e5e1344ce49044688572b9d942 Reviewed-on: https://webrtc-review.googlesource.com/c/120048 Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26425}
This commit is contained in:
parent
a3ed451548
commit
435ea0a741
@ -126,6 +126,7 @@ std::vector<std::unique_ptr<RtpPacketToSend>> FlexfecSender::GetFecPackets() {
|
||||
for (const auto* fec_packet : ulpfec_generator_.generated_fec_packets_) {
|
||||
std::unique_ptr<RtpPacketToSend> fec_packet_to_send(
|
||||
new RtpPacketToSend(&rtp_header_extension_map_));
|
||||
fec_packet_to_send->set_is_fec(true);
|
||||
|
||||
// RTP header.
|
||||
fec_packet_to_send->SetMarker(false);
|
||||
|
||||
@ -38,6 +38,10 @@ class RtpPacketToSend : public RtpPacket {
|
||||
|
||||
void set_capture_time_ms(int64_t time) { capture_time_ms_ = time; }
|
||||
|
||||
bool is_fec() const { return is_fec_; }
|
||||
|
||||
void set_is_fec(bool fec) { is_fec_ = fec; }
|
||||
|
||||
// Additional data bound to the RTP packet for use in application code,
|
||||
// outside of WebRTC.
|
||||
rtc::ArrayView<const uint8_t> application_data() const {
|
||||
@ -74,6 +78,8 @@ class RtpPacketToSend : public RtpPacket {
|
||||
|
||||
private:
|
||||
int64_t capture_time_ms_ = 0;
|
||||
// Used for accounting purposes
|
||||
bool is_fec_ = false;
|
||||
std::vector<uint8_t> application_data_;
|
||||
};
|
||||
|
||||
|
||||
@ -786,7 +786,7 @@ void RTPSender::UpdateRtpStats(const RtpPacketToSend& packet,
|
||||
if (counters->first_packet_time_ms == -1)
|
||||
counters->first_packet_time_ms = now_ms;
|
||||
|
||||
if (IsFecPacket(packet))
|
||||
if (packet.is_fec())
|
||||
counters->fec.AddPacket(packet);
|
||||
|
||||
if (is_retransmit) {
|
||||
@ -799,22 +799,6 @@ void RTPSender::UpdateRtpStats(const RtpPacketToSend& packet,
|
||||
rtp_stats_callback_->DataCountersUpdated(*counters, packet.Ssrc());
|
||||
}
|
||||
|
||||
bool RTPSender::IsFecPacket(const RtpPacketToSend& packet) const {
|
||||
if (!video_)
|
||||
return false;
|
||||
|
||||
// FlexFEC.
|
||||
if (packet.Ssrc() == FlexfecSsrc())
|
||||
return true;
|
||||
|
||||
// RED+ULPFEC.
|
||||
int pt_red;
|
||||
int pt_fec;
|
||||
video_->GetUlpfecConfig(&pt_red, &pt_fec);
|
||||
return static_cast<int>(packet.PayloadType()) == pt_red &&
|
||||
static_cast<int>(packet.payload()[0]) == pt_fec;
|
||||
}
|
||||
|
||||
size_t RTPSender::TimeToSendPadding(size_t bytes,
|
||||
const PacedPacketInfo& pacing_info) {
|
||||
if (bytes == 0)
|
||||
|
||||
@ -261,6 +261,7 @@ void RTPSenderVideo::SendVideoPacketAsRedMaybeWithUlpfec(
|
||||
new RtpPacketToSend(*media_packet));
|
||||
RTC_CHECK(rtp_packet->Parse(fec_packet->data(), fec_packet->length()));
|
||||
rtp_packet->set_capture_time_ms(media_packet->capture_time_ms());
|
||||
rtp_packet->set_is_fec(true);
|
||||
uint16_t fec_sequence_number = rtp_packet->SequenceNumber();
|
||||
if (rtp_sender_->SendToNetwork(std::move(rtp_packet), fec_storage,
|
||||
RtpPacketSender::kLowPriority)) {
|
||||
@ -323,13 +324,6 @@ void RTPSenderVideo::SetUlpfecConfig(int red_payload_type,
|
||||
key_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom};
|
||||
}
|
||||
|
||||
void RTPSenderVideo::GetUlpfecConfig(int* red_payload_type,
|
||||
int* ulpfec_payload_type) const {
|
||||
rtc::CritScope cs(&crit_);
|
||||
*red_payload_type = red_payload_type_;
|
||||
*ulpfec_payload_type = ulpfec_payload_type_;
|
||||
}
|
||||
|
||||
size_t RTPSenderVideo::CalculateFecPacketOverhead() const {
|
||||
if (flexfec_enabled())
|
||||
return flexfec_sender_->MaxPacketOverhead();
|
||||
|
||||
@ -59,7 +59,6 @@ class RTPSenderVideo {
|
||||
|
||||
// ULPFEC.
|
||||
void SetUlpfecConfig(int red_payload_type, int ulpfec_payload_type);
|
||||
void GetUlpfecConfig(int* red_payload_type, int* ulpfec_payload_type) const;
|
||||
|
||||
// FlexFEC/ULPFEC.
|
||||
void SetFecParameters(const FecProtectionParams& delta_params,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user