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

@ -190,6 +190,11 @@ class PhysicalSocket : public Socket, public sigslot::has_slots<> {
const struct sockaddr* dest_addr,
socklen_t addrlen);
int DoReadFromSocket(void* buffer,
size_t length,
SocketAddress* out_addr,
int64_t* timestamp);
void OnResolveResult(AsyncResolverInterface* resolver);
void UpdateLastError();
@ -216,6 +221,7 @@ class PhysicalSocket : public Socket, public sigslot::has_slots<> {
#endif
private:
const bool read_scm_timestamp_experiment_;
uint8_t enabled_events_ = 0;
};