aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/udp.c
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2021-11-24 20:09:53 +0800
committerLimin Wang <lance.lmwang@gmail.com>2021-11-26 17:43:48 +0800
commit27c930002702f512b80124249c5efbcc0ef04841 (patch)
treeb2e1a231474dc49d99a02331aa8c4a6397cd553a /libavformat/udp.c
parentb3624069f05f1445ae75ba461e4e8ebc347ddf50 (diff)
downloadffmpeg-27c930002702f512b80124249c5efbcc0ef04841.tar.gz
avformat/udp: remove local localaddr array
Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavformat/udp.c')
-rw-r--r--libavformat/udp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c
index bbe5aecc46..b8b0e19609 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -623,7 +623,7 @@ end:
/* return non zero if error */
static int udp_open(URLContext *h, const char *uri, int flags)
{
- char hostname[1024], localaddr[1024] = "";
+ char hostname[1024];
int port, udp_fd = -1, tmp, bind_ret = -1, dscp = -1;
UDPContext *s = h->priv_data;
int is_output;
@@ -708,7 +708,8 @@ static int udp_open(URLContext *h, const char *uri, int flags)
s->burst_bits = strtoll(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "localaddr", p)) {
- av_strlcpy(localaddr, buf, sizeof(localaddr));
+ av_freep(&s->localaddr);
+ s->localaddr = av_strdup(buf);
}
if (av_find_info_tag(buf, sizeof(buf), "sources", p)) {
if ((ret = ff_ip_parse_sources(h, buf, &s->filters)) < 0)
@@ -748,10 +749,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
if ((s->is_multicast || s->local_port <= 0) && (h->flags & AVIO_FLAG_READ))
s->local_port = port;
- if (localaddr[0])
- udp_fd = udp_socket_create(h, &my_addr, &len, localaddr);
- else
- udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr);
+ udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr);
if (udp_fd < 0)
goto fail;