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 7DB0F4EAD6 for ; Fri, 13 Jun 2025 08:56:36 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 6A4F968C5DD; Fri, 13 Jun 2025 11:56:29 +0300 (EEST) To: ffmpeg-devel@ffmpeg.org Date: Fri, 13 Jun 2025 16:56:15 +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 v3 2/3] avformat/whip: add whip_flags ignore_ipv6 to skip IPv6 candidates Content-Type: multipart/mixed; boundary="===============1201040902927854106==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1201040902927854106== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from xmbghk7.mail.qq.com (xmbghk7.mail.qq.com [43.163.128.50]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 7BFEB68C5C2 for ; Fri, 13 Jun 2025 11:56:22 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1749804979; bh=D9UwSF99XfnWXxp3BiMVlgyGrfJo+hQZRJd18UC39f4=; h=From:To:Cc:Subject:Date; b=juWTMqcAOMASQAcZSC3w6mhV0yjJ/2ZmvLZr6Jml1ZdNpm3NT4Kn+IfrhTsmR4XzI dvLyVF/uksNTIJBWca3YXnzj7AFO5z/oYsmCFCnLq/b5lMlrXR5kqx+9ry3BKrdwwP pYpmntbkCS4oge31NCNysM1rHw8Wn53gj+DJ8GvI= Received: from localhost.localdomain ([111.33.195.50]) by newxmesmtplogicsvrsza29-0.qq.com (NewEsmtp) with SMTP id E118960D; Fri, 13 Jun 2025 16:56:17 +0800 X-QQ-mid: xmsmtpt1749804977tf8pg4duz Message-ID: X-QQ-XMAILINFO: N+tZcXNNUKPOme+2F7xdTP4YOrSR9VVODNkWfLGEylJzLZEo8PD23R24zHtcKe Txhde497Ozc6P/T/PP6H4M8e/p+xk9oMRAZOp5algJRC+uyDaIy+AyPboS1BQUK6nzgVYEB5VdMg Sm80pH/wCJ/OkUJhg/ZIghAyBnql0l6gDzx0K+kLlbLOW+ycGcmpaL2d536jZtrxDCnKkuMA7Cha ubDKm16l9kfg8NzswyTmDZk4ROqI2ViKSVp5UtN7X8j4TcNSCmxArugMUB+WQtdutLcgAIJTZ8to RKvvge9Uo2aHEUm3gnksd7yTojO3gQGW9cP1tapWErmRyx+Qmo1qmh5cDG2MRSVz46KlGgMy+0NH JlAPeep4seVIwY5Q2Wb7Q44dU4Ca2dHVkVL2VoOS0neFruFVlbHHosUupsw/ib04O2FJ8ix9mYzJ JF2jO1e3Ise3R6IVE7yOlUEDyEyeZ/4eGO97Q6uAGNuFZlEkyeWTaThVSaK+euRus9Zdi4M/VVkE moIvAEom79YhkihOeiQf9wzEVezo0aDPnEPEHCSd6oqhjD7xl2rewQq2F5QsWCq/qOEgcMCg0PC3 gX+fPVI09A2bTR5KXKn4F3iw6wVldKmR6SVi6GZoH8tSdl5HPg1tLpOQpdVV8Qz3V11BrI92Jt/J zKTpN6PekT9oNehhT5KgwboRPA2eQd/A1/JoWjrArH05+OW/Ub0rsOv9pdndOIPQFneHwcJPYzcd WvOGLkciTb/tdZCvertnHkbnAZj/VK5kJxyVHzrrE630JAAz6AUMeuEn51kBCZWrus6MIFnrJqK5 qs3RPg274R1Fo6LDFisD5yqF5mFLuA+8kqXCXJfE4Q22CCGvkvucxMOt+mBEOAPHoVYK9M7kJIld 8pz9YmF8T23Ce56oTUIxZFyMF5uWie0PXTxiekDonbJGZbOWPasAmZjH9bL5KCGr6JpdEJNGXa4l C/JOXldiwtOp8yeXZU1+nKxSIqwo/JMCN6CnhnToKC+6cVWA71uA== X-QQ-XMRINFO: Mp0Kj//9VHAxr69bL5MkOOs= From: Jack Lau To: ffmpeg-devel@ffmpeg.org Cc: Jack Lau Subject: [PATCH v3 2/3] avformat/whip: add whip_flags ignore_ipv6 to skip IPv6 candidates Date: Fri, 13 Jun 2025 16:56:15 +0800 X-OQ-MSGID: <20250613085615.26150-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 a6827d3478..84c2092e5e 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. */ @@ -871,6 +876,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", @@ -879,6 +885,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, "WHIP: Ignore ipv6 %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); @@ -1892,6 +1903,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", "The 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 --===============1201040902927854106== 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". --===============1201040902927854106==--