Commit bdba57a1 authored by Simon Morlat's avatar Simon Morlat

fix SO_TIMESTAMP checking for MacOS

parent d5bd5ea2
......@@ -1334,7 +1334,7 @@ int rtp_session_rtp_recv_abstract(ortp_socket_t socket, mblk_t *msg, int flags,
ret = bytes_received;
#endif
for (cmsghdr = CMSG_FIRSTHDR(&msghdr); cmsghdr != NULL ; cmsghdr = CMSG_NXTHDR(&msghdr, cmsghdr)) {
if (cmsghdr->cmsg_level == SOL_SOCKET && cmsghdr->cmsg_type == SO_TIMESTAMP) {
if (cmsghdr->cmsg_level == SOL_SOCKET && cmsghdr->cmsg_type == SCM_TIMESTAMP) {
memcpy(&msg->timestamp, (struct timeval *)CMSG_DATA(cmsghdr), sizeof(struct timeval));
}
#ifdef IP_PKTINFO
......@@ -1378,6 +1378,15 @@ int rtp_session_rtp_recv_abstract(ortp_socket_t socket, mblk_t *msg, int flags,
}
#endif
}
if (msg->timestamp.tv_sec == 0){
static int warn_once = 1; /*VERY BAD to use a static but there is no context in this function to hold this variable*/
if (warn_once){
ortp_warning("This platform doesn't implement SO_TIMESTAMP, will use gettimeofday() instead.");
warn_once = 0;
}
ortp_gettimeofday(&msg->timestamp, NULL);
}
/*store recv addr for use by modifiers*/
if (from && fromlen) {
memcpy(&msg->net_addr,from,*fromlen);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment