Increase the UDP receive buffer for video
Lost packets have been seen in high-bitrate applications and increasing the UDP receive buffer reduced the problems. Bug: b/115713113 Change-Id: I671f528afeaea525150fdc2013f2b245778e5d16 Reviewed-on: https://webrtc-review.googlesource.com/c/107580 Commit-Queue: Johannes Kron <kron@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25328}
This commit is contained in:
parent
f0c449e3ff
commit
d38a2b860b
@ -14,5 +14,6 @@ namespace cricket {
|
||||
|
||||
const int kMinVideoBitrateBps = 30000;
|
||||
const int kVideoMtu = 1200;
|
||||
const int kVideoRtpBufferSize = 65536;
|
||||
const int kVideoRtpSendBufferSize = 65536;
|
||||
const int kVideoRtpRecvBufferSize = 262144;
|
||||
} // namespace cricket
|
||||
|
||||
@ -14,7 +14,8 @@
|
||||
namespace cricket {
|
||||
|
||||
extern const int kVideoMtu;
|
||||
extern const int kVideoRtpBufferSize;
|
||||
extern const int kVideoRtpSendBufferSize;
|
||||
extern const int kVideoRtpRecvBufferSize;
|
||||
|
||||
extern const char kH264CodecName[];
|
||||
|
||||
|
||||
@ -1461,27 +1461,15 @@ void WebRtcVideoChannel::SetInterface(
|
||||
MediaChannel::SetInterface(iface, media_transport);
|
||||
// Set the RTP recv/send buffer to a bigger size.
|
||||
|
||||
// The group here can be either a positive integer with an explicit size, in
|
||||
// which case that is used as size. All other values shall result in the
|
||||
// default value being used.
|
||||
const std::string group_name =
|
||||
webrtc::field_trial::FindFullName("WebRTC-IncreasedReceivebuffers");
|
||||
int recv_buffer_size = kVideoRtpBufferSize;
|
||||
if (!group_name.empty() &&
|
||||
(sscanf(group_name.c_str(), "%d", &recv_buffer_size) != 1 ||
|
||||
recv_buffer_size <= 0)) {
|
||||
RTC_LOG(LS_WARNING) << "Invalid receive buffer size: " << group_name;
|
||||
recv_buffer_size = kVideoRtpBufferSize;
|
||||
}
|
||||
MediaChannel::SetOption(NetworkInterface::ST_RTP, rtc::Socket::OPT_RCVBUF,
|
||||
recv_buffer_size);
|
||||
kVideoRtpRecvBufferSize);
|
||||
|
||||
// Speculative change to increase the outbound socket buffer size.
|
||||
// In b/15152257, we are seeing a significant number of packets discarded
|
||||
// due to lack of socket buffer space, although it's not yet clear what the
|
||||
// ideal value should be.
|
||||
MediaChannel::SetOption(NetworkInterface::ST_RTP, rtc::Socket::OPT_SNDBUF,
|
||||
kVideoRtpBufferSize);
|
||||
kVideoRtpSendBufferSize);
|
||||
}
|
||||
|
||||
void WebRtcVideoChannel::SetFrameDecryptor(
|
||||
|
||||
@ -1485,60 +1485,7 @@ TEST_F(WebRtcVideoChannelBaseTest, SetSendSetsTransportBufferSizes) {
|
||||
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
|
||||
EXPECT_TRUE(SetSend(true));
|
||||
EXPECT_EQ(64 * 1024, network_interface_.sendbuf_size());
|
||||
EXPECT_EQ(64 * 1024, network_interface_.recvbuf_size());
|
||||
}
|
||||
|
||||
// Test that we properly set the send and recv buffer sizes when overriding
|
||||
// via field trials.
|
||||
TEST_F(WebRtcVideoChannelBaseTest, OverridesRecvBufferSize) {
|
||||
// Set field trial to override the default recv buffer size, and then re-run
|
||||
// setup where the interface is created and configured.
|
||||
const int kCustomRecvBufferSize = 123456;
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-IncreasedReceivebuffers/123456/");
|
||||
SetUp();
|
||||
|
||||
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
|
||||
EXPECT_TRUE(SetSend(true));
|
||||
EXPECT_EQ(64 * 1024, network_interface_.sendbuf_size());
|
||||
EXPECT_EQ(kCustomRecvBufferSize, network_interface_.recvbuf_size());
|
||||
}
|
||||
|
||||
// Test that we properly set the send and recv buffer sizes when overriding
|
||||
// via field trials with suffix.
|
||||
TEST_F(WebRtcVideoChannelBaseTest, OverridesRecvBufferSizeWithSuffix) {
|
||||
// Set field trial to override the default recv buffer size, and then re-run
|
||||
// setup where the interface is created and configured.
|
||||
const int kCustomRecvBufferSize = 123456;
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-IncreasedReceivebuffers/123456_Dogfood/");
|
||||
SetUp();
|
||||
|
||||
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
|
||||
EXPECT_TRUE(SetSend(true));
|
||||
EXPECT_EQ(64 * 1024, network_interface_.sendbuf_size());
|
||||
EXPECT_EQ(kCustomRecvBufferSize, network_interface_.recvbuf_size());
|
||||
}
|
||||
|
||||
// Test that we properly set the send and recv buffer sizes when overriding
|
||||
// via field trials that don't make any sense.
|
||||
TEST_F(WebRtcVideoChannelBaseTest, InvalidRecvBufferSize) {
|
||||
// Set bogus field trial values to override the default recv buffer size, and
|
||||
// then re-run setup where the interface is created and configured. The
|
||||
// default value should still be used.
|
||||
|
||||
for (std::string group : {" ", "NotANumber", "-1", "0"}) {
|
||||
std::string field_trial_string = "WebRTC-IncreasedReceivebuffers/";
|
||||
field_trial_string += group;
|
||||
field_trial_string += "/";
|
||||
webrtc::test::ScopedFieldTrials field_trial(field_trial_string);
|
||||
SetUp();
|
||||
|
||||
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
|
||||
EXPECT_TRUE(SetSend(true));
|
||||
EXPECT_EQ(64 * 1024, network_interface_.sendbuf_size());
|
||||
EXPECT_EQ(64 * 1024, network_interface_.recvbuf_size());
|
||||
}
|
||||
EXPECT_EQ(256 * 1024, network_interface_.recvbuf_size());
|
||||
}
|
||||
|
||||
// Test that stats work properly for a 1-1 call.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user