From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id EDE8F40FCE for ; Sat, 12 Feb 2022 00:40:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2423B68B15F; Sat, 12 Feb 2022 02:40:10 +0200 (EET) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AB2B768B07E for ; Sat, 12 Feb 2022 02:40:03 +0200 (EET) Received: by mail-pj1-f53.google.com with SMTP id t4-20020a17090a510400b001b8c4a6cd5dso10296699pjh.5 for ; Fri, 11 Feb 2022 16:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=PPLFnujRvvHgRZICa5Nb2Socke4qtKPQrIYMkR/JPJI=; b=iLp2R0BSMzxAn1MA9Y95RK3AF+5AZx3afv//JOrTSxjZNnuTZ9FKBfCUli0mdB9cH4 5DQi2vfEKBhZtzhcOSQzWgFdXsfMJfVX2K6hHN1VjgTAFBkMe0iXcteypp31s820GVxN 36FMK4803FkvhVrsI8HG7Nqfo+o82xljQZkjpWlSWS4PPcoXj3SU9acEE4ErWQ9wy4Eq 6H1jjx97TbOXxdNVDQdwH8pn3Iwj/lhszZbHyURhWUH4YVW5d4H/WknvlrkO9ECHLliI x9vlQf6HKn74qILqyDdybpn191XU9LLPWt5Ly6BlQVwcBiPowu4n6aFKX2nLPPXHG7Yq F9mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=PPLFnujRvvHgRZICa5Nb2Socke4qtKPQrIYMkR/JPJI=; b=krt+BgwEsoik23LoxqXc3ZliowTN9HWQRH/b0JsCLT2F8PGACS6rrpC08MG+awmnrm JEvm5lDuFI5XbUBQ3wQjpGrZD9CYQwuDyLLnl9OtU0sAqkKih0cBlBwTEH2mPfjRjugr aCe8fJqj0UhWkReaNFjOFZnhgQ+R+eDlmdxfx6zMiy3UTyY1pZYYQLI0a7LtXQSpl/oU pj7aNJ4alAGQRKCvVbOnu0BDIFMSITUK8cgPZB9/YtpTFSL5gzEIf4cBmgQTqEGyP9R3 5fLK1O4guJr44pBIf+SsegJQT4/e/6omkpYfZJdYag/PCQc8A4+LV0R+uDtmAdjUon8S Xmfg== X-Gm-Message-State: AOAM530WoUFeaDj8zmy3Uzhdd8xAipkBBrEnteuZaxNAKgmcgXFIdB0d G/qcCex7IOy4e8kRMhEwUorW7WSbsdQ= X-Google-Smtp-Source: ABdhPJw2JCT3zkbzgB4fRLygaX3UI4KoF078bMcW1s5ejsvunHcegV4F/oImF19yh6isEfRxxkpMMA== X-Received: by 2002:a17:902:b68b:: with SMTP id c11mr3988022pls.116.1644626401539; Fri, 11 Feb 2022 16:40:01 -0800 (PST) Received: from gmail.com ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id s32sm21395121pfw.80.2022.02.11.16.40.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Feb 2022 16:40:01 -0800 (PST) Date: Sat, 12 Feb 2022 08:39:57 +0800 From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Message-ID: <20220212003957.GA28629@gmail.com> Mail-Followup-To: ffmpeg-devel@ffmpeg.org References: <1643260580-25792-1-git-send-email-lance.lmwang@gmail.com> <1644064308-21729-1-git-send-email-lance.lmwang@gmail.com> <1644064308-21729-2-git-send-email-lance.lmwang@gmail.com> <9258182-4e3-e34e-a9bb-9de3d3450b4@passwd.hu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9258182-4e3-e34e-a9bb-9de3d3450b4@passwd.hu> Subject: Re: [FFmpeg-devel] [PATCH v3 2/3] avformat/udp: Fix IP_MULTICAST_TTL for BSD compatibility 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, Feb 11, 2022 at 10:05:19PM +0100, Marton Balint wrote: > > > On Sat, 5 Feb 2022, lance.lmwang@gmail.com wrote: > > > From: Limin Wang > > > > Suggested by zhilizhao, vlc project has solved the compatibility by > > the same way, so I borrowed the comments from vlc project. > > > > Fix #ticket9449 > > > > Signed-off-by: Limin Wang > > --- > > libavformat/udp.c | 15 +++++++++++++-- > > 1 file changed, 13 insertions(+), 2 deletions(-) > > > > diff --git a/libavformat/udp.c b/libavformat/udp.c > > index 8178d0e..1871acf 100644 > > --- a/libavformat/udp.c > > +++ b/libavformat/udp.c > > @@ -164,6 +164,10 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL, > > { > > int protocol, cmd; > > > > + /* There is some confusion in the world whether IP_MULTICAST_TTL > > + * takes a byte or an int as an argument. > > + * BSD seems to indicate byte so we are going with that and use > > + * int and fall back to byte to be safe */ > > switch (addr->sa_family) { > > #ifdef IP_MULTICAST_TTL > > case AF_INET: > > @@ -182,8 +186,15 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL, > > } > > > > if (setsockopt(sockfd, protocol, cmd, &mcastTTL, sizeof(mcastTTL)) < 0) { > > - ff_log_net_error(logctx, AV_LOG_ERROR, "setsockopt(IPV4/IPV6 MULTICAST TTL)"); > > - return ff_neterrno(); > > + /* BSD compatibility */ > > + unsigned char ttl; > > + > > + ff_log_net_error(logctx, AV_LOG_DEBUG, "setsockopt(IPV4/IPV6 MULTICAST TTL)"); > > + ttl = (unsigned char)(( mcastTTL > 255 ) ? 255 : mcastTTL); > > I guess this limit check here is no longer needed after the range checking > patches, so just remove. Otherwise LGTM. Yes, I have replied to Chad Fraleigh in another email and have removed the check already. > > Thanks, > Marton > > > + if (setsockopt(sockfd, protocol, cmd, &ttl, sizeof(ttl)) < 0) { > > + ff_log_net_error(logctx, AV_LOG_ERROR, "setsockopt(IPV4/IPV6 MULTICAST TTL)"); > > + return ff_neterrno(); > > + } > > } > > > > return 0; > > -- > > 1.8.3.1 > > > > _______________________________________________ > > 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". > > > _______________________________________________ > 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". -- Thanks, Limin Wang _______________________________________________ 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".