Index: webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
index 378ef130d1a27811137462ace01ece5ca2fe4e19..c1830aae4fabf6fe22f6bc374ce63e66848f4970 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
@@ -116,14 +116,14 @@ void RTPSenderVideo::SendVideoPacketAsRed(uint8_t* data_buffer, |
StorageType media_packet_storage, |
bool protect) { |
std::unique_ptr<RedPacket> red_packet; |
- std::vector<RedPacket*> fec_packets; |
+ std::vector<std::unique_ptr<RedPacket>> fec_packets; |
StorageType fec_storage = kDontRetransmit; |
uint16_t next_fec_sequence_number = 0; |
{ |
// Only protect while creating RED and FEC packets, not when sending. |
rtc::CritScope cs(&crit_); |
- red_packet.reset(producer_fec_.BuildRedPacket( |
- data_buffer, payload_length, rtp_header_length, red_payload_type_)); |
+ red_packet = ProducerFec::BuildRedPacket( |
+ data_buffer, payload_length, rtp_header_length, red_payload_type_); |
if (protect) { |
producer_fec_.AddRtpPacketAndGenerateFec(data_buffer, payload_length, |
rtp_header_length); |
@@ -132,7 +132,7 @@ void RTPSenderVideo::SendVideoPacketAsRed(uint8_t* data_buffer, |
if (num_fec_packets > 0) { |
next_fec_sequence_number = |
_rtpSender.AllocateSequenceNumber(num_fec_packets); |
- fec_packets = producer_fec_.GetFecPackets( |
+ fec_packets = producer_fec_.GetFecPacketsAsRed( |
red_payload_type_, fec_payload_type_, next_fec_sequence_number, |
rtp_header_length); |
RTC_DCHECK_EQ(num_fec_packets, fec_packets.size()); |
@@ -152,7 +152,7 @@ void RTPSenderVideo::SendVideoPacketAsRed(uint8_t* data_buffer, |
} else { |
LOG(LS_WARNING) << "Failed to send RED packet " << media_seq_num; |
} |
- for (RedPacket* fec_packet : fec_packets) { |
+ for (const auto& fec_packet : fec_packets) { |
if (_rtpSender.SendToNetwork( |
fec_packet->data(), fec_packet->length() - rtp_header_length, |
rtp_header_length, capture_time_ms, fec_storage, |
@@ -166,7 +166,6 @@ void RTPSenderVideo::SendVideoPacketAsRed(uint8_t* data_buffer, |
LOG(LS_WARNING) << "Failed to send FEC packet " |
<< next_fec_sequence_number; |
} |
- delete fec_packet; |
++next_fec_sequence_number; |
} |
} |
@@ -247,7 +246,11 @@ int32_t RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType, |
rtc::CritScope cs(&crit_); |
FecProtectionParams* fec_params = |
frameType == kVideoFrameKey ? &key_fec_params_ : &delta_fec_params_; |
- producer_fec_.SetFecParameters(fec_params, 0); |
+ // We currently do not use unequal protection in the FEC. |
+ // This is signalled both here (by setting the number of important |
+ // packets to zero), as well as in ProducerFec::AddRtpPacketAndGenerateFec. |
+ constexpr int kNumImportantPackets = 0; |
+ producer_fec_.SetFecParameters(fec_params, kNumImportantPackets); |
storage = packetizer->GetStorageType(_retransmissionSettings); |
red_payload_type = red_payload_type_; |
} |