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 <jacklau1...@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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to