From: Camille Oudot <camille+ffmpeg-devel@voila.events> To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH] avformat/rtpproto: add support for RTP/UDP socket reuse Date: Tue, 03 Jan 2023 20:13:12 +0100 Message-ID: <d62116671aece359696c378f7efe437183694082.camel@voila.events> (raw) In-Reply-To: <3621898.0Uz0849ZAC@basile.remlab.net> Why does the "reuse" option exists on the "udp" protocol in the first place? Why would it not apply to "rtp" also? Here is the original patch proposal on udp: http://ffmpeg.org/pipermail/ffmpeg-devel/2006-October/thread.html#18946 > Sure. But then that does not solve the problem of RTCP mux and SDP > bundle, which normally would use the exact same IP address and port > number on the local end (and also on the far end, if set). I confirm the requirement is to send several RTP streams with FFmpeg with identical proto/src_ip/src_port/dst_ip/dst_port. > > > It's not that simple. The semantics of REUSEPORT varies between Linux > and BSD. IIRC, REUSEPORT was originally meant by BSD to allow > multiple processes to listen on the same multicast group, but then > Linux redefined it with radically different semantics, for receive > load-balancing purpose. They added SO_REUSEPORT_LB in BSD to mimic the Linux behavior. > > Repeating myself, but I don't see how that solves the problem. You > don't need REUSEADDR for two sockets to send to the same remote > IP/port, and you cannot rely on it to send from the same local > IP/port. It *does* work, at least on Linux: I can send several RTP streams from the exact same local IP/port (and _to_ the same IP/port too but that's not a problem in general as you point it) with either REUSEADDR or REUSEPORT options set. Here are ffmpeg strace traces for local RTCP port == local RTP port. The command sends a video stream to the following RTP URL (RTP and are sent from the same local source port): rtp://127.0.0.1:40000?localaddr=127.0.0.1&localport=22300&localrtcpport =22300&rtcpport=40000 without SO_REUSEPORT ==================== ... socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP) = 4 bind(4, {sa_family=AF_INET, sin_port=htons(22300), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 getsockname(4, {sa_family=AF_INET, sin_port=htons(22300), in_addr=inet_addr("127.0.0.1")}, [128->16]) = 0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [32768], 4) = 0 socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP) = 5 bind(5, {sa_family=AF_INET, sin_port=htons(22300), in_addr=inet_addr("127.0.0.1")}, 16) = -1 EADDRINUSE (Address already in use) with SO_REUSEPORT ================= ... socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP) = 4 setsockopt(4, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0 bind(4, {sa_family=AF_INET, sin_port=htons(22300), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 getsockname(4, {sa_family=AF_INET, sin_port=htons(22300), sin_addr=inet_addr("127.0.0.1")}, [128->16]) = 0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [32768], 4) = 0 socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP) = 5 setsockopt(5, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0 bind(5, {sa_family=AF_INET, sin_port=htons(22300), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 Regards -- Camille _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-01-03 19:13 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-22 15:28 Camille Oudot 2022-12-22 15:42 ` Camille Oudot 2022-12-22 19:32 ` Nicolas George 2022-12-24 11:36 ` Rémi Denis-Courmont 2022-12-24 13:07 ` Camille Oudot 2022-12-25 10:00 ` Rémi Denis-Courmont 2022-12-25 23:52 ` Camille Oudot 2022-12-26 3:20 ` "zhilizhao(赵志立)" 2022-12-26 21:47 ` Nicolas George 2022-12-27 0:46 ` "zhilizhao(赵志立)" 2022-12-31 19:34 ` Rémi Denis-Courmont 2023-01-03 9:03 ` Camille Oudot 2023-01-03 16:03 ` Rémi Denis-Courmont 2023-01-03 19:13 ` Camille Oudot [this message] 2023-01-03 19:43 ` Nicolas George 2023-01-04 11:24 ` Camille Oudot 2023-01-05 12:16 ` Nicolas George
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=d62116671aece359696c378f7efe437183694082.camel@voila.events \ --to=camille+ffmpeg-devel@voila.events \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git