Skip to content

Commit 1b2955d

Browse files
committed
Merge branch 'bugfix/fix_host_candidate_gather' into 'main'
Fix host candidate not found See merge request adf/esp-webrtc-solution!20
2 parents f0f5e8c + 533069f commit 1b2955d

File tree

9 files changed

+41
-5
lines changed

9 files changed

+41
-5
lines changed

components/esp_capture/src/impl/capture_simple_path/esp_capture_path_simple.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ static void simple_capture_venc_thread(void *arg)
336336
capture->src_cfg.release_src_frame(capture->src_cfg.src_ctx, &frame);
337337
if (ret != ESP_CAPTURE_ERR_OK) {
338338
if (ret == ESP_CAPTURE_ERR_NOT_ENOUGH) {
339-
ESP_LOGW(TAG, "Bad input maybe skipped");
339+
ESP_LOGW(TAG, "Bad input maybe skipped size %d", (int)res->video_frame_size);
340340
continue;
341341
}
342342
ESP_LOGE(TAG, "Fail to encode video frame");

components/esp_capture/src/impl/capture_video_enc/capture_video_enc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int venc_get_frame_size(esp_capture_venc_if_t *h, int *in_frame_size, int
106106
if (venc->info.codec == ESP_CAPTURE_CODEC_TYPE_MJPEG) {
107107
*out_frame_size = *in_frame_size / 20;
108108
} else if (venc->info.codec == ESP_CAPTURE_CODEC_TYPE_H264) {
109-
*out_frame_size = *in_frame_size / 2;
109+
*out_frame_size = *in_frame_size;
110110
*out_frame_size = ALIGN_UP(*out_frame_size, 128);
111111
} else {
112112
return ESP_CAPTURE_ERR_NOT_SUPPORTED;

components/esp_webrtc/impl/apprtc_signal/https_client.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ int https_send_request(const char *method, char **headers, const char *url, char
116116
.event_handler = _http_event_handler,
117117
.crt_bundle_attach = esp_crt_bundle_attach,
118118
.user_data = &info,
119+
.timeout_ms = 10000, // Change default timeout to be 10s
119120
};
120121
esp_http_client_handle_t client = esp_http_client_init(&config);
121122
if (client == NULL) {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

components/esp_webrtc/src/esp_webrtc.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,20 @@ int esp_webrtc_open(esp_webrtc_cfg_t *cfg, esp_webrtc_handle_t *handle)
667667
rtc->rtc_cfg.peer_cfg.server_num = 0;
668668
rtc->rtc_cfg.peer_cfg.server_lists = NULL;
669669
malloc_server_cfg(rtc, cfg->peer_cfg.server_lists, cfg->peer_cfg.server_num);
670+
if (cfg->peer_cfg.extra_cfg) {
671+
void *peer_exta_cfg = calloc(1, cfg->peer_cfg.extra_size);
672+
if (peer_exta_cfg) {
673+
memcpy(peer_exta_cfg, cfg->peer_cfg.extra_cfg, cfg->peer_cfg.extra_size);
674+
}
675+
rtc->rtc_cfg.peer_cfg.extra_cfg = peer_exta_cfg;
676+
}
677+
if (cfg->signaling_cfg.extra_cfg) {
678+
void *signaling_cfg = calloc(1, cfg->signaling_cfg.extra_size);
679+
if (signaling_cfg) {
680+
memcpy(signaling_cfg, cfg->signaling_cfg.extra_cfg, cfg->signaling_cfg.extra_size);
681+
}
682+
rtc->rtc_cfg.signaling_cfg.extra_cfg = signaling_cfg;
683+
}
670684
*handle = rtc;
671685
return ESP_PEER_ERR_NONE;
672686
}
@@ -858,6 +872,8 @@ int esp_webrtc_close(esp_webrtc_handle_t handle)
858872
webrtc_t *rtc = (webrtc_t *)handle;
859873
esp_webrtc_stop(handle);
860874
free_server_cfg(rtc);
875+
SAFE_FREE(rtc->rtc_cfg.peer_cfg.extra_cfg);
876+
SAFE_FREE(rtc->rtc_cfg.signaling_cfg.extra_cfg);
861877
SAFE_FREE(rtc->aud_fifo);
862878
free(rtc);
863879
return ESP_PEER_ERR_NONE;

solutions/doorbell_demo/main/main.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ static char room_url[128];
4141
} \
4242
media_lib_thread_create_from_scheduler(NULL, #name, run_async##name, NULL);
4343

44+
char server_url[64] = "https://webrtc.espressif.com";
45+
4446
static int join_room(int argc, char **argv)
4547
{
4648
int nerrors = arg_parse(argc, argv, (void **)&room_args);
@@ -55,7 +57,7 @@ static int join_room(int argc, char **argv)
5557
}
5658
}
5759
const char *room_id = room_args.room_id->sval[0];
58-
snprintf(room_url, sizeof(room_url), "https://webrtc.espressif.cn/join/%s", room_id);
60+
snprintf(room_url, sizeof(room_url), "%s/join/%s", server_url, room_id);
5961
ESP_LOGI(TAG, "Start to join in room %s", room_id);
6062
start_webrtc(room_url);
6163
return 0;
@@ -95,6 +97,18 @@ static int wifi_cli(int argc, char **argv)
9597
return network_connect_wifi(ssid, password);
9698
}
9799

100+
static int server_cli(int argc, char **argv)
101+
{
102+
int server_sel = argc > 1 ? atoi(argv[1]) : 0;
103+
if (server_sel == 0) {
104+
strcpy(server_url, "https://webrtc.espressif.com");
105+
} else {
106+
strcpy(server_url, "https://webrtc.espressif.cn");
107+
}
108+
ESP_LOGI(TAG, "Select server %s", server_url);
109+
return 0;
110+
}
111+
98112
static int capture_to_player_cli(int argc, char **argv)
99113
{
100114
return test_capture_to_player();
@@ -174,6 +188,11 @@ static int init_console()
174188
.help = "measure system loading\r\n",
175189
.func = measure_cli,
176190
},
191+
{
192+
.command = "server",
193+
.help = "Select server\r\n",
194+
.func = server_cli,
195+
},
177196
};
178197
for (int i = 0; i < sizeof(cmds) / sizeof(cmds[0]); i++) {
179198
ESP_ERROR_CHECK(esp_console_cmd_register(&cmds[i]));
@@ -221,10 +240,10 @@ static int network_event_handler(bool connected)
221240
// Enter into Room directly
222241
RUN_ASYNC(start, {
223242
char *room = gen_room_id_use_mac();
224-
snprintf(room_url, sizeof(room_url), "https://webrtc.espressif.cn/join/%s", room);
243+
snprintf(room_url, sizeof(room_url), "%s/join/%s", server_url, room);
225244
ESP_LOGI(TAG, "Start to join in room %s", room);
226245
if (start_webrtc(room_url) == 0) {
227-
ESP_LOGW(TAG, "Please use browser to join in %s on https://webrtc.espressif.cn/doorbell", room);
246+
ESP_LOGW(TAG, "Please use browser to join in %s on %s/webrtc.espressif.cn/doorbell", server_url, room);
228247
}
229248
});
230249
} else {

0 commit comments

Comments
 (0)