Cleanup expired experiment WebRTC-SCM-Timestamp

Bug: webrtc:5773
Change-Id: I4950c70865c7f458324d11b74dd1043e93bc10f6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347882
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42145}
This commit is contained in:
Per K 2024-04-19 06:31:23 +00:00 committed by WebRTC LUCI CQ
parent cc3ce280fe
commit 58cccc62cc
5 changed files with 17 additions and 69 deletions

View file

@ -117,9 +117,6 @@ ACTIVE_FIELD_TRIALS: FrozenSet[FieldTrial] = frozenset([
FieldTrial('WebRTC-RtcEventLogEncodeNetEqSetMinimumDelayKillSwitch',
'webrtc:14763',
date(2024, 4, 1)),
FieldTrial('WebRTC-SCM-Timestamp',
'webrtc:5773',
date(2024, 4, 1)),
FieldTrial('WebRTC-SetCodecPreferences-ReceiveOnlyFilterInsteadOfThrow',
'webrtc:15396',
date(2024, 12, 1)),

View file

@ -21,12 +21,6 @@
namespace rtc {
// Returns true if the experiement "WebRTC-SCM-Timestamp" is explicitly
// disabled.
static bool IsScmTimeStampExperimentDisabled() {
return webrtc::field_trial::IsDisabled("WebRTC-SCM-Timestamp");
}
AsyncUDPSocket* AsyncUDPSocket::Create(Socket* socket,
const SocketAddress& bind_address) {
std::unique_ptr<Socket> owned_socket(socket);
@ -133,15 +127,9 @@ void AsyncUDPSocket::OnReadEvent(Socket* socket) {
receive_buffer.arrival_time = webrtc::Timestamp::Micros(rtc::TimeMicros());
} else {
if (!socket_time_offset_) {
// Estimate timestamp offset from first packet arrival time unless
// disabled
bool estimate_time_offset = !IsScmTimeStampExperimentDisabled();
if (estimate_time_offset) {
socket_time_offset_ = webrtc::Timestamp::Micros(rtc::TimeMicros()) -
*receive_buffer.arrival_time;
} else {
socket_time_offset_ = webrtc::TimeDelta::Micros(0);
}
// Estimate timestamp offset from first packet arrival time.
socket_time_offset_ = webrtc::Timestamp::Micros(rtc::TimeMicros()) -
*receive_buffer.arrival_time;
}
*receive_buffer.arrival_time += *socket_time_offset_;
}

View file

@ -148,12 +148,6 @@ class ScopedSetTrue {
bool* value_;
};
// Returns true if the experiement "WebRTC-SCM-Timestamp" is explicitly
// disabled.
bool IsScmTimeStampExperimentDisabled() {
return webrtc::field_trial::IsDisabled("WebRTC-SCM-Timestamp");
}
} // namespace
namespace rtc {
@ -163,8 +157,7 @@ PhysicalSocket::PhysicalSocket(PhysicalSocketServer* ss, SOCKET s)
s_(s),
error_(0),
state_((s == INVALID_SOCKET) ? CS_CLOSED : CS_CONNECTED),
resolver_(nullptr),
read_scm_timestamp_experiment_(!IsScmTimeStampExperimentDisabled()) {
resolver_(nullptr) {
if (s_ != INVALID_SOCKET) {
SetEnabledEvents(DE_READ | DE_WRITE);
@ -523,14 +516,13 @@ int PhysicalSocket::DoReadFromSocket(void* buffer,
#if defined(WEBRTC_POSIX)
int received = 0;
if (read_scm_timestamp_experiment_) {
iovec iov = {.iov_base = buffer, .iov_len = length};
msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
if (out_addr) {
out_addr->Clear();
msg.msg_name = addr;
msg.msg_namelen = addr_len;
}
iovec iov = {.iov_base = buffer, .iov_len = length};
msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
if (out_addr) {
out_addr->Clear();
msg.msg_name = addr;
msg.msg_namelen = addr_len;
}
// TODO(bugs.webrtc.org/15368): What size is needed? IPV6_TCLASS is supposed
// to be an int. Why is a larger size needed?
char control[CMSG_SPACE(sizeof(struct timeval) + 5 * sizeof(int))] = {};
@ -567,19 +559,6 @@ int PhysicalSocket::DoReadFromSocket(void* buffer,
if (out_addr) {
SocketAddressFromSockAddrStorage(addr_storage, out_addr);
}
} else { // !read_scm_timestamp_experiment_
if (out_addr) {
received = ::recvfrom(s_, static_cast<char*>(buffer),
static_cast<int>(length), 0, addr, &addr_len);
SocketAddressFromSockAddrStorage(addr_storage, out_addr);
} else {
received =
::recv(s_, static_cast<char*>(buffer), static_cast<int>(length), 0);
}
if (timestamp) {
*timestamp = GetSocketRecvTimestamp(s_);
}
}
return received;
#else
@ -852,13 +831,10 @@ bool SocketDispatcher::Initialize() {
ioctlsocket(s_, FIONBIO, &argp);
#elif defined(WEBRTC_POSIX)
fcntl(s_, F_SETFL, fcntl(s_, F_GETFL, 0) | O_NONBLOCK);
if (!IsScmTimeStampExperimentDisabled()) {
int value = 1;
// Attempt to get receive packet timestamp from the socket.
if (::setsockopt(s_, SOL_SOCKET, SO_TIMESTAMP, &value, sizeof(value)) !=
0) {
RTC_DLOG(LS_ERROR) << "::setsockopt failed. errno: " << LAST_SYSTEM_ERROR;
}
int value = 1;
// Attempt to get receive packet timestamp from the socket.
if (::setsockopt(s_, SOL_SOCKET, SO_TIMESTAMP, &value, sizeof(value)) != 0) {
RTC_DLOG(LS_ERROR) << "::setsockopt failed. errno: " << LAST_SYSTEM_ERROR;
}
#endif
@ -868,10 +844,11 @@ bool SocketDispatcher::Initialize() {
// we attempt to write to such a socket, SIGPIPE will be raised, which by
// default will terminate the process, which we don't want. By specifying
// this socket option, SIGPIPE will be disabled for the socket.
int value = 1;
value = 1;
if (::setsockopt(s_, SOL_SOCKET, SO_NOSIGPIPE, &value, sizeof(value)) != 0) {
RTC_DLOG(LS_ERROR) << "::setsockopt failed. errno: " << LAST_SYSTEM_ERROR;
}
#endif
ss_->Add(this);
return true;

View file

@ -252,7 +252,6 @@ class PhysicalSocket : public Socket, public sigslot::has_slots<> {
#endif
private:
const bool read_scm_timestamp_experiment_;
uint8_t enabled_events_ = 0;
};

View file

@ -471,19 +471,6 @@ TEST_F(PhysicalSocketTest, TestSocketRecvTimestampIPv6) {
SocketTest::TestSocketRecvTimestampIPv6();
}
#if !defined(WEBRTC_MAC)
TEST_F(PhysicalSocketTest, TestSocketRecvTimestampIPv4ScmExperimentDisabled) {
MAYBE_SKIP_IPV4;
webrtc::test::ScopedFieldTrials trial("WebRTC-SCM-Timestamp/Disabled/");
SocketTest::TestSocketRecvTimestampIPv4();
}
TEST_F(PhysicalSocketTest, TestSocketRecvTimestampIPv6ScmExperimentDisabled) {
webrtc::test::ScopedFieldTrials trial("WebRTC-SCM-Timestamp/Disabled/");
SocketTest::TestSocketRecvTimestampIPv6();
}
#endif
#if !defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
// TODO(bugs.webrtc.org/15368): IpV4 fails on IOS and MAC. IPV6 works.
TEST_F(PhysicalSocketTest, TestSocketSendRecvWithEcnIPv4) {