From patchwork Thu Nov 25 10:45:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31659 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp475211iob; Thu, 25 Nov 2021 02:45:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxi1glnvR3WL7u+/KQVrLQKMicCjPpm+WzV9dUFrprL3F2FkoPh+fD2dbZVvNxuDNODtBl/ X-Received: by 2002:a17:906:a1da:: with SMTP id bx26mr30479184ejb.558.1637837154044; Thu, 25 Nov 2021 02:45:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637837154; cv=none; d=google.com; s=arc-20160816; b=UkXkevDyuiABIMNft/LSm0L2bqcLPknXP/kfHyvYgraFSGOM8bIzC2n0X9LgNIEB8G fwWDIuD0YxbWvr9+H+z1rqRtGxvMZU1KheXyZEIwxrtZeJYqSNWLLEEqx+6qvTBuf4G5 ACz6FHVP1D/645FxrQuy7GTjdjw6nww+DckGHEPJ6lRingvdMvIPysHQ8BuYTbowo0+3 7r1/fl1dcZHq6+Aj4cT2mC/Y1hTLvzgfHCuioN7pzIrSEGJHoFaD4/+s/S0mopGUhemG JNCJO4s6PS1L3AiUVQwu+Vq5Zv31cAIVW9C7YbDk8n8Q7EVCcbftGNhOC4guPdcCgaqN tCIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=ligwG/E21khfgyLKw3g38LbiP5zSwSLBF6idWHB1emg=; b=oWLzS4HoCE58+uHPCdvySsA9097gwlYb11Z+qzmvDeslp3305E0LoXXOhcAKstwTak Udz2Wn/gmemG6XdRsf4mGxygXrt3J6y0fp4MaQFACuk5RJomNCLiy7zxs6LU/bbw+KXV lYl0RXgQXU4jAuwtR3kKuVM/jJuBYuMIpDQA+bLBK1W80bAf9zBY+3G2+6m9X9P9uJj3 9a6kLzxplDP5Pkl7gbNmbFjNnhE6IaXxEricVP/uea2/SJ8lvHXTecvb52WBXERgMjPw spgHPzAD6swDNYuedO9byJtxnqYSerg3hXT/dIHs9Nn+hZvojIGEXFt/UMoXsFQxRMJj bERg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=llF9jkEX; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hq3si10157422ejc.142.2021.11.25.02.45.53; Thu, 25 Nov 2021 02:45:54 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=llF9jkEX; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DC69068AEC1; Thu, 25 Nov 2021 12:45:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4DD49689A13 for ; Thu, 25 Nov 2021 12:45:35 +0200 (EET) Received: by mail-pg1-f176.google.com with SMTP id r138so4850304pgr.13 for ; Thu, 25 Nov 2021 02:45:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cVn75nqYfOCLA9J9NiLkkPJWegutNAlxHs6RXMGS0LE=; b=llF9jkEXvn7RcyS5FDOtLRI09AzTp2UsiZnlmIayZQTJTVQ5QjbQLSjjpEkNzyLMn/ CG5JI+wCGEZpkklSYi/NcLVaW41cIowRs1NrMy3tLy9/eGi33ApD0YWAoI4vNlhYlBbI 4aNHBHWX9PhxgGbQz8wwe1PDpR1I2552+gt2IhHCbHRqMbg5u8hYh6a1JAZyy8ngsiya wc8xDgYV2n90Qo3uvuLvaDr0XLdH2O6uIV4pE4FAxoJAjbwMY4IEap7kxdbgGWIc6T7L 0IhaLiVDzltrD1dmKoIEzeGw0PimH+cTots9X6UrlZZjbVHsgzxdS8iePBO1Ml1jkCYj QdsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cVn75nqYfOCLA9J9NiLkkPJWegutNAlxHs6RXMGS0LE=; b=xIbYXuFhYXL5H35J/qdmPBN8J992DyaA+3icw9aW3gCzmo5lxQKyOULwO3vlF0BJ1l 22W7LSuNl+7gwsw5LpkaCuBuwjlrp83OjKIUo+5vzmPWae4TYOqIq9hduaetNaGnDHPx pLvnJ8zLONlQ2TfrziWWThhtGIk/wjdI/NJyjB7nYPp9gbLrGLz+YonowP8Kpic9TRuU 2KMMHLd1xRyv7jciYggawycxMUlyhuWeaCYF8/wJwcrVKhhFGCH6ck9e2OYKKHGUovRa +LuUPD4qFlDl8lJHCYZWRqOUHOqZkSqGWSu5svLaahIEOpTYn1Dpo0g3iRD6TVUl7lsD kLyQ== X-Gm-Message-State: AOAM530+Cn1LmiSf+Qx8UIU3aJEpnW2mJXQPjJWDBvt6DSHZFe9I9UIp gDhLwSmCuZ2JaqRIKwD9v416VASpVB0= X-Received: by 2002:aa7:9d9e:0:b0:4a0:25d0:a06f with SMTP id f30-20020aa79d9e000000b004a025d0a06fmr13648447pfq.82.1637837133646; Thu, 25 Nov 2021 02:45:33 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id g9sm3110429pfc.182.2021.11.25.02.45.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Nov 2021 02:45:33 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Nov 2021 18:45:28 +0800 Message-Id: <1637837128-31393-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1637837128-31393-1-git-send-email-lance.lmwang@gmail.com> References: <1637837128-31393-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/2] avformat/udp: remove local localaddr array X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: aeeoLiz4WQH1 From: Limin Wang Signed-off-by: Limin Wang --- libavformat/udp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavformat/udp.c b/libavformat/udp.c index bbe5aec..b8b0e19 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;