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 ae491209b7f22edf1ff3d063a66ded37dfeff200..23bb2e2db1b0a24b6c70e72ef599066d0b5b7198 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc |
@@ -36,6 +36,7 @@ namespace webrtc { |
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. |
@@ -483,6 +484,11 @@ size_t RTPSender::SendPadData(size_t bytes, int probe_cluster_id) { |
// if a single packet is larger than requested. |
size_t padding_bytes_in_packet = |
mflodman
2017/01/26 14:03:37
Can we do this if (!audio_configured_) {} else {}
stefan-webrtc
2017/01/27 12:53:01
Didn't become that much better, but it's hopefully
|
std::min(MaxPayloadSize(), kMaxPaddingLength); |
+ if (audio_configured_) { |
+ // Allow smaller padding packets for audio. |
+ padding_bytes_in_packet = std::max(std::min(bytes, padding_bytes_in_packet), |
+ kMinAudioPaddingLength); |
+ } |
size_t bytes_sent = 0; |
while (bytes_sent < bytes) { |
int64_t now_ms = clock_->TimeInMilliseconds(); |
@@ -500,8 +506,9 @@ size_t RTPSender::SendPadData(size_t bytes, int probe_cluster_id) { |
capture_time_ms = capture_time_ms_; |
if (rtx_ == kRtxOff) { |
// Without RTX we can't send padding in the middle of frames. |
- if (!last_packet_marker_bit_) |
+ if (!audio_configured_ && !last_packet_marker_bit_) { |
stefan-webrtc
2017/01/24 15:34:02
Audio streams typically don't use the marker bit,
mflodman
2017/01/26 14:03:37
Marker bits are used in the beginning of a talk sp
stefan-webrtc
2017/01/27 12:53:01
Done.
mflodman
2017/01/27 13:03:39
Thanks!
|
break; |
+ } |
ssrc = ssrc_; |
sequence_number = sequence_number_; |
++sequence_number_; |
@@ -793,7 +800,7 @@ bool RTPSender::IsFecPacket(const RtpPacketToSend& packet) const { |
} |
size_t RTPSender::TimeToSendPadding(size_t bytes, int probe_cluster_id) { |
- if (audio_configured_ || bytes == 0) |
+ if (bytes == 0) |
return 0; |
size_t bytes_sent = TrySendRedundantPayloads(bytes, probe_cluster_id); |
if (bytes_sent < bytes) |