@@ -144,6 +144,11 @@ static int extract_ice_info(whip_signaling_t *sig, char *link)
144144 if (sig -> server_num > MAX_SERVER_SUPPORT ) {
145145 return ESP_PEER_ERR_OVER_LIMITED ;
146146 }
147+ // Check if this Link header is for an ICE server
148+ if (strstr (link , "rel=\"ice-server\"" ) == NULL ) {
149+ ESP_LOGD (TAG , "Skip link not for ICE server: %s" , link );
150+ return ESP_PEER_ERR_NONE ;
151+ }
147152 esp_peer_ice_server_cfg_t server_cfg = {};
148153 char * start , * end ;
149154 start = strstr (link , "<" );
@@ -155,6 +160,7 @@ static int extract_ice_info(whip_signaling_t *sig, char *link)
155160 return ESP_PEER_ERR_INVALID_ARG ;
156161 }
157162 * end = '\0' ; // Terminate the URL
163+
158164 server_cfg .stun_url = strdup (start + 1 );
159165 * end = '>' ;
160166 start = end + 1 ;
@@ -228,13 +234,13 @@ static int whip_signaling_send_msg(esp_peer_signaling_handle_t h, esp_peer_signa
228234 }
229235 sig -> local_sdp_sent = true;
230236 if (sig -> server_num ) {
231- // update ice_info
232- esp_peer_signaling_ice_info_t iec_info = {
237+ // Update ice_info
238+ esp_peer_signaling_ice_info_t ice_info = {
233239 .is_initiator = true,
234240 .server_info = * sig -> ice_servers [0 ],
235241 };
236242 // TODO support more servers?
237- sig -> cfg .on_ice_info (& iec_info , sig -> cfg .ctx );
243+ sig -> cfg .on_ice_info (& ice_info , sig -> cfg .ctx );
238244 }
239245 // Try to extractor stun lists
240246 esp_peer_signaling_msg_t sdp_msg = {
0 commit comments