Index: webrtc/modules/rtp_rtcp/source/rtp_sender.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc |
index c28420cfbe827d0652ad275b79d291dc1a58a8c0..add7c21e9be22e109c15227de2b7ee0ac4336c7f 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc |
@@ -36,7 +36,6 @@ |
namespace { |
// Max in the RFC 3550 is 255 bytes, we limit it to be modulus 32 for SRTP. |
constexpr size_t kMaxPaddingLength = 224; |
-constexpr size_t kMinAudioPaddingLength = 50; |
constexpr int kSendSideDelayWindowMs = 1000; |
constexpr size_t kRtpHeaderLength = 12; |
constexpr uint16_t kMaxInitRtpSeqNumber = 32767; // 2^15 -1. |
@@ -482,21 +481,11 @@ |
} |
size_t RTPSender::SendPadData(size_t bytes, int probe_cluster_id) { |
- size_t padding_bytes_in_packet; |
- if (audio_configured_) { |
- // Allow smaller padding packets for audio. |
- padding_bytes_in_packet = std::max(std::min(bytes, MaxPayloadSize()), |
- kMinAudioPaddingLength); |
- if (padding_bytes_in_packet > kMaxPaddingLength) |
- padding_bytes_in_packet = kMaxPaddingLength; |
- } else { |
- // Always send full padding packets. This is accounted for by the |
- // RtpPacketSender, which will make sure we don't send too much padding even |
- // if a single packet is larger than requested. |
- // We do this to avoid frequently sending small packets on higher bitrates. |
- padding_bytes_in_packet = |
- std::min(MaxPayloadSize(), kMaxPaddingLength); |
- } |
+ // Always send full padding packets. This is accounted for by the |
+ // RtpPacketSender, which will make sure we don't send too much padding even |
+ // if a single packet is larger than requested. |
+ size_t padding_bytes_in_packet = |
+ std::min(MaxPayloadSize(), kMaxPaddingLength); |
size_t bytes_sent = 0; |
while (bytes_sent < bytes) { |
int64_t now_ms = clock_->TimeInMilliseconds(); |
@@ -513,15 +502,9 @@ |
timestamp = last_rtp_timestamp_; |
capture_time_ms = capture_time_ms_; |
if (rtx_ == kRtxOff) { |
- if (payload_type_ == -1) |
+ // Without RTX we can't send padding in the middle of frames. |
+ if (!last_packet_marker_bit_) |
break; |
- // Without RTX we can't send padding in the middle of frames. |
- // For audio marker bits doesn't mark the end of a frame and frames |
- // are usually a single packet, so for now we don't apply this rule |
- // for audio. |
- if (!audio_configured_ && !last_packet_marker_bit_) { |
- break; |
- } |
ssrc = ssrc_; |
sequence_number = sequence_number_; |
++sequence_number_; |
@@ -813,7 +796,7 @@ |
} |
size_t RTPSender::TimeToSendPadding(size_t bytes, int probe_cluster_id) { |
- if (bytes == 0) |
+ if (audio_configured_ || bytes == 0) |
return 0; |
size_t bytes_sent = TrySendRedundantPayloads(bytes, probe_cluster_id); |
if (bytes_sent < bytes) |