[FFmpeg-devel] [PATCH 4/4] avformat/udp: fix udp server mode haven't dest_addr
Jack Lau
jacklau1222gm at gmail.com
Wed Jul 9 16:36:29 EEST 2025
If udp is in server mode(init local addr and port through url),
then it maybe haven't dest_addr, so we should set it after udp_read
get the client addr and port
Signed-off-by: Jack Lau <jacklau1222 at qq.com>
---
libavformat/udp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 0fde3548e7..6a2ed2cdcd 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -1144,6 +1144,8 @@ static int udp_write(URLContext *h, const uint8_t *buf, int size)
}
if (!s->is_connected) {
+ if (!s->dest_addr_len && !s->dest_addr.ss_family)
+ ff_udp_get_last_recv_addr(h, &s->dest_addr, &s->dest_addr_len);
ret = sendto (s->udp_fd, buf, size, 0,
(struct sockaddr *) &s->dest_addr,
s->dest_addr_len);
--
2.49.0
More information about the ffmpeg-devel
mailing list