From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 38B4D4FBB1 for ; Sat, 28 Jun 2025 02:15:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 7DEED68E25A; Sat, 28 Jun 2025 05:15:05 +0300 (EEST) To: ffmpeg-devel@ffmpeg.org Date: Sat, 28 Jun 2025 10:14:48 +0800 MIME-Version: 1.0 Message-ID: List-Id: FFmpeg development discussions and patches List-Post: From: Jack Lau via ffmpeg-devel Precedence: list Cc: Jack Lau X-Mailman-Version: 2.1.29 X-BeenThere: ffmpeg-devel@ffmpeg.org List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: FFmpeg development discussions and patches List-Help: Subject: [FFmpeg-devel] [PATCH v4 1/3] avformat/whip: add whip_flags ignore_ipv6 to skip IPv6 ICE candidates Content-Type: multipart/mixed; boundary="===============0386112505452959894==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0386112505452959894== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-57-49.mail.qq.com (out162-62-57-49.mail.qq.com [162.62.57.49]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id E003768DDE3 for ; Sat, 28 Jun 2025 05:14:57 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1751076894; bh=T9bwGUBhN8Dvs2K5a0nb/B3tHnZsGUl/50JrtFhnUh8=; h=From:To:Cc:Subject:Date; b=nspp0aLC4ookdI+WYpkZjUQcvZFgNHj9WdgtlQ0iofczyE6FQYTf61KQxiSfdbPIP BoXaBui/uVCSaDLQ/x5181xoaRZc+LMFfVxiplm9+e4A9yBzonPuSehqbi0ATVmd5N E2RYQNRXUbtRd9BaRQjogvRJoGl6W3FwRQ1MRWiQ= Received: from localhost.localdomain ([111.31.253.220]) by newxmesmtplogicsvrszc13-0.qq.com (NewEsmtp) with SMTP id 3B50DAE6; Sat, 28 Jun 2025 10:14:53 +0800 X-QQ-mid: xmsmtpt1751076893tqqf084m4 Message-ID: X-QQ-XMAILINFO: N/WmRbclY25GLYZc0lzTwhBfYs9LQx7KSumEzCbUSlQ4IWVRFYXZU6Ge91/A/W cUmzmnyY97RFbtNFBtBq2ae9/Lw6WhWHTQLgpYhh5aDTJNFRM95xA11I0S7Q2BsdoZGRrWUfVw60 g54CIsvNvQWYxO7BrYGuH7DjRWGHAnNcCiG4j/vgT1i6zNlVldrtz/ylEkDVdOPYbKnQTOFPSJ15 0CjjW1/50HIqjvYrpBJVzNhuPgnK35oxmSa97AAPFowXFuqTX5A/b47RRGPrgT7rMQQTK1h2V82M wLbIpO+sGSEqe5/CJsOf2+JTtpoUGotlcigwt1imj0t3LayggOF+IbSOYFwK27BSpQnNmyABQ0oH ZeBz8gFjcIQDsyXvVyfcC2v4P2fyuAVg56eJ5FZ39a4iPPFsW6OVGcnFhFBOwD/bgXTFNB9o3qTS HXMDGCgHrKFz2wQXG7ZXllnodZ94OdrtaP53fZFJKa0iTnEoEroWGPR0iwkTFAQJ2qgT2OkzCRMR 5fDEe4N7Tr/VVeRI/jFJ605mqBotmBLjW3jUh4agKnmw3XYVyBFz1PY6SJcq5MBh2DhGz4OVF7oO q/T1Yd848/T57q9NBCHSOok7/es3mMJQSOQNV1Nv6zYF0n4+PfUssaEaYIuek6VpLHoDYGAkYv2H aowKxZ3qtlpCZ5uvqCnHxZ26JxuvGOAmY+W6NkIJqmPwgB1PheLbte9qO5TbvV8HrBgymH7Mq47v QoajH67kFt0wHaE6//is1xyRir/OOtiHXfYtsnsB9ZrZZ6bNoowwa6/8/YRtvg7+gE048E0kF5k+ CkQ+Xq7E6JgbyWJk0DWeGlMf+dOu/rDsaeoEdy/ZTYyIZKY4Ug0u1H90V6xUEjPSGeEAGhMWwClH 48vnkjNpnb1dVWoAOqJcdcNYky0zhl6qneinqBK0sf5GX/sGal4Vci2BrZuL61LfxF9TughgagoN LBVRTynUKUvp/ti0cKfW+e2eKJ2W/18yvqO2v6pFDmYenbwOjCPgYgKZuVmVHCK8PFxqvQpxvd+g CUV16VCMmsseAoR+Oyq7erSDTfhc6i0guqEq3ifw== X-QQ-XMRINFO: NI4Ajvh11aEj8Xl/2s1/T8w= From: Jack Lau To: ffmpeg-devel@ffmpeg.org Cc: Jack Lau Subject: [PATCH v4 1/3] avformat/whip: add whip_flags ignore_ipv6 to skip IPv6 ICE candidates Date: Sat, 28 Jun 2025 10:14:48 +0800 X-OQ-MSGID: <20250628021450.77418-1-jacklau1222@qq.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Unsent: 1 Content-Transfer-Encoding: 8bit mark this ignore_ipv6 flag could ignore any IPv6 ICE candidate, preventing “No route to host” errors on devices without IPv6 connectivity. Signed-off-by: Jack Lau --- libavformat/whip.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libavformat/whip.c b/libavformat/whip.c index 5fdbd6949d..be6ee9c951 100644 --- a/libavformat/whip.c +++ b/libavformat/whip.c @@ -193,9 +193,14 @@ enum WHIPState { WHIP_STATE_FAILED, }; +typedef enum WHIPFlags { + WHIP_FLAG_IGNORE_IPV6 = (1 << 0) // Ignore ipv6 candidate +} WHIPFlags; + typedef struct WHIPContext { AVClass *av_class; + uint32_t flags; // enum WHIPFlags /* The state of the RTC connection. */ enum WHIPState state; /* The callback return value for DTLS. */ @@ -879,6 +884,7 @@ static int parse_answer(AVFormatContext *s) if (ptr && av_stristr(ptr, "host")) { char protocol[17], host[129]; int priority, port; + struct in6_addr addr6; ret = sscanf(ptr, "%16s %d %128s %d typ host", protocol, &priority, host, &port); if (ret != 4) { av_log(whip, AV_LOG_ERROR, "WHIP: Failed %d to parse line %d %s from %s\n", @@ -887,6 +893,11 @@ static int parse_answer(AVFormatContext *s) goto end; } + if (whip->flags & WHIP_FLAG_IGNORE_IPV6 && inet_pton(AF_INET6, host, &addr6) == 1) { + av_log(whip, AV_LOG_DEBUG, "Ignoring IPv6 ICE candidates %s, line %d %s \n", host, i, line); + continue; + } + if (av_strcasecmp(protocol, "udp")) { av_log(whip, AV_LOG_ERROR, "WHIP: Protocol %s is not supported by RTC, choose udp, line %d %s of %s\n", protocol, i, line, whip->sdp_answer); @@ -1898,6 +1909,8 @@ static const AVOption options[] = { { "authorization", "The optional Bearer token for WHIP Authorization", OFFSET(authorization), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, ENC }, { "cert_file", "The optional certificate file path for DTLS", OFFSET(cert_file), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, ENC }, { "key_file", "The optional private key file path for DTLS", OFFSET(key_file), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, ENC }, + { "whip_flags", "Set flags affecting WHIP connection behavior", OFFSET(flags), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, 0, UINT_MAX, ENC, .unit = "flags" }, + { "ignore_ipv6", "(Optional) Ignore any IPv6 ICE candidate", 0, AV_OPT_TYPE_CONST, { .i64 = WHIP_FLAG_IGNORE_IPV6 }, 0, UINT_MAX, ENC, .unit = "flags" }, { NULL }, }; -- 2.49.0 --===============0386112505452959894== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============0386112505452959894==--