Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: webrtc/modules/rtp_rtcp/source/forward_error_correction.cc

Issue 2275443002: Minor fixes in FEC and RtpSender{,Video}. (pt. 2) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@header_reader_writer-pt1-move_copy_column
Patch Set: Rebase. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/forward_error_correction.cc
diff --git a/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc b/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc
index e666421e210df6fe873efeda11b22bb83a7502fb..b214f60c061ae802edcfed8e821fd8a9d3405910 100644
--- a/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc
+++ b/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc
@@ -119,18 +119,16 @@ int ForwardErrorCorrection::GenerateFec(const PacketList& media_packets,
bool l_bit = (num_media_packets > 8 * kMaskSizeLBitClear);
int num_mask_bytes = l_bit ? kMaskSizeLBitSet : kMaskSizeLBitClear;
- // Do some error checking on the media packets.
+ // Error check the media packets.
for (const auto& media_packet : media_packets) {
RTC_DCHECK(media_packet);
-
if (media_packet->length < kRtpHeaderSize) {
LOG(LS_WARNING) << "Media packet " << media_packet->length << " bytes "
<< "is smaller than RTP header.";
return -1;
}
-
- // Ensure our FEC packets will fit in a typical MTU.
- if (media_packet->length + PacketOverhead() + kTransportOverhead >
+ // Ensure the FEC packets will fit in a typical MTU.
+ if (media_packet->length + MaxPacketOverhead() + kTransportOverhead >
IP_PACKET_SIZE) {
LOG(LS_WARNING) << "Media packet " << media_packet->length << " bytes "
<< "with overhead is larger than " << IP_PACKET_SIZE
@@ -138,8 +136,7 @@ int ForwardErrorCorrection::GenerateFec(const PacketList& media_packets,
}
}
- int num_fec_packets = GetNumberOfFecPackets(num_media_packets,
- protection_factor);
+ int num_fec_packets = NumFecPackets(num_media_packets, protection_factor);
if (num_fec_packets == 0) {
return 0;
}
@@ -177,8 +174,8 @@ int ForwardErrorCorrection::GenerateFec(const PacketList& media_packets,
return 0;
}
-int ForwardErrorCorrection::GetNumberOfFecPackets(int num_media_packets,
- int protection_factor) {
+int ForwardErrorCorrection::NumFecPackets(int num_media_packets,
+ int protection_factor) {
// Result in Q0 with an unsigned round.
int num_fec_packets = (num_media_packets * protection_factor + (1 << 7)) >> 8;
// Generate at least one FEC packet if we need protection.
@@ -776,7 +773,7 @@ int ForwardErrorCorrection::DecodeFec(
return 0;
}
-size_t ForwardErrorCorrection::PacketOverhead() {
+size_t ForwardErrorCorrection::MaxPacketOverhead() const {
return kFecHeaderSize + kUlpHeaderSizeLBitSet;
}
} // namespace webrtc
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/forward_error_correction.h ('k') | webrtc/modules/rtp_rtcp/source/producer_fec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698