Add experiment to use ::recvmsg to receive packets on posix systems

Using ::recvmsg ensure packet timestamp can then be read directly when reading the buffer
instead of a separate system call and should also work on Ios/Mac.

The same experiment field trial flag will be "WebRTC-SCM-Timestamp/enabled/" and is also planned to be used for fixing webrtc:14066

Bug: webrtc:5773, webrtc:14066
Change-Id: I8a3749e87c686aa18fcee947472c1b602a0f63c8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279280
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38585}
This commit is contained in:
Per Kjellander
2022-11-08 12:48:52 +01:00
committed by WebRTC LUCI CQ
parent 119fb1910a
commit fdcfefa708
5 changed files with 132 additions and 20 deletions

View File

@ -23,6 +23,7 @@
#include "rtc_base/socket_unittest.h"
#include "rtc_base/test_utils.h"
#include "rtc_base/thread.h"
#include "test/field_trial.h"
#include "test/gtest.h"
namespace rtc {
@ -460,8 +461,9 @@ TEST_F(PhysicalSocketTest, TestGetSetOptionsIPv6) {
#if defined(WEBRTC_POSIX)
// We don't get recv timestamps on Mac.
#if !defined(WEBRTC_MAC)
// We don't get recv timestamps on Mac without the experiment
// WebRTC-SCM-Timestamp
TEST_F(PhysicalSocketTest, TestSocketRecvTimestampIPv4) {
MAYBE_SKIP_IPV4;
SocketTest::TestSocketRecvTimestampIPv4();
@ -472,6 +474,16 @@ TEST_F(PhysicalSocketTest, TestSocketRecvTimestampIPv6) {
}
#endif
TEST_F(PhysicalSocketTest, TestSocketRecvTimestampIPv4ScmExperiment) {
MAYBE_SKIP_IPV4;
webrtc::test::ScopedFieldTrials trial("WebRTC-SCM-Timestamp/Enabled/");
SocketTest::TestSocketRecvTimestampIPv4();
}
TEST_F(PhysicalSocketTest, TestSocketRecvTimestampIPv6ScmExperiment) {
webrtc::test::ScopedFieldTrials trial("WebRTC-SCM-Timestamp/Enabled/");
SocketTest::TestSocketRecvTimestampIPv6();
}
// Verify that if the socket was unable to be bound to a real network interface
// (not loopback), Bind will return an error.
TEST_F(PhysicalSocketTest,