@@ -193,9 +193,14 @@ enum WHIPState {
193
193
WHIP_STATE_FAILED ,
194
194
};
195
195
196
+ typedef enum WHIPFlags {
197
+ WHIP_FLAG_IGNORE_IPV6 = (1 << 0 ) // Ignore ipv6 candidate
198
+ } WHIPFlags ;
199
+
196
200
typedef struct WHIPContext {
197
201
AVClass * av_class ;
198
202
203
+ uint32_t flags ; // enum WHIPFlags
199
204
/* The state of the RTC connection. */
200
205
enum WHIPState state ;
201
206
/* The callback return value for DTLS. */
@@ -871,6 +876,7 @@ static int parse_answer(AVFormatContext *s)
871
876
if (ptr && av_stristr (ptr , "host" )) {
872
877
char protocol [17 ], host [129 ];
873
878
int priority , port ;
879
+ struct in6_addr addr6 ;
874
880
ret = sscanf (ptr , "%16s %d %128s %d typ host" , protocol , & priority , host , & port );
875
881
if (ret != 4 ) {
876
882
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)
879
885
goto end ;
880
886
}
881
887
888
+ if (whip -> flags & WHIP_FLAG_IGNORE_IPV6 && inet_pton (AF_INET6 , host , & addr6 ) == 1 ) {
889
+ av_log (whip , AV_LOG_DEBUG , "WHIP: Ignore ipv6 %s, line %d %s \n" , host , i , line );
890
+ continue ;
891
+ }
892
+
882
893
if (av_strcasecmp (protocol , "udp" )) {
883
894
av_log (whip , AV_LOG_ERROR , "WHIP: Protocol %s is not supported by RTC, choose udp, line %d %s of %s\n" ,
884
895
protocol , i , line , whip -> sdp_answer );
@@ -1892,6 +1903,8 @@ static const AVOption options[] = {
1892
1903
{ "authorization" , "The optional Bearer token for WHIP Authorization" , OFFSET (authorization ), AV_OPT_TYPE_STRING , { .str = NULL }, 0 , 0 , ENC },
1893
1904
{ "cert_file" , "The optional certificate file path for DTLS" , OFFSET (cert_file ), AV_OPT_TYPE_STRING , { .str = NULL }, 0 , 0 , ENC },
1894
1905
{ "key_file" , "The optional private key file path for DTLS" , OFFSET (key_file ), AV_OPT_TYPE_STRING , { .str = NULL }, 0 , 0 , ENC },
1906
+ { "whip_flags" , "set flags affecting WHIP connection behavior" , OFFSET (flags ), AV_OPT_TYPE_FLAGS , { .i64 = 0 }, 0 , UINT_MAX , ENC , .unit = "flags" },
1907
+ { "ignore_ipv6" , "ignore any IPv6 ICE candidate" , 0 , AV_OPT_TYPE_CONST , { .i64 = WHIP_FLAG_IGNORE_IPV6 }, 0 , UINT_MAX , ENC , .unit = "flags" },
1895
1908
{ NULL },
1896
1909
};
1897
1910
0 commit comments