Skip to content

Commit

Permalink
[esp32] Enable usrsctp option
Browse files Browse the repository at this point in the history
  • Loading branch information
sepfy committed Sep 8, 2024
1 parent a97fbb0 commit b9ad642
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
2 changes: 2 additions & 0 deletions examples/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(esp32-peer)

# Uncomment if using usrsctp.
#idf_build_set_property(COMPILE_OPTIONS "-DHAVE_USRSCTP" APPEND)
22 changes: 7 additions & 15 deletions examples/esp32/main/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
static const char* TAG = "webrtc";

static TaskHandle_t xPcTaskHandle = NULL;
static TaskHandle_t xPsTaskHandle = NULL;
static TaskHandle_t xCameraTaskHandle = NULL;
static TaskHandle_t xAudioTaskHandle = NULL;

Expand Down Expand Up @@ -64,16 +63,6 @@ void onopen(void* userdata) {
static void onclose(void* userdata) {
}

void peer_signaling_task(void* arg) {
ESP_LOGI(TAG, "peer_signaling_task started");

for (;;) {
peer_signaling_loop();

vTaskDelay(pdMS_TO_TICKS(10));
}
}

void peer_connection_task(void* arg) {
ESP_LOGI(TAG, "peer_connection_task started");

Expand Down Expand Up @@ -144,19 +133,22 @@ void app_main(void) {
peer_signaling_join_channel(deviceid, g_pc);

#if defined(CONFIG_ESP32S3_XIAO_SENSE)
xTaskCreatePinnedToCore(audio_task, "audio", 8192, NULL, 7, &xAudioTaskHandle, 0);
StackType_t* stack_memory = (StackType_t*)heap_caps_malloc(8192 * sizeof(StackType_t), MALLOC_CAP_SPIRAM);
StaticTask_t task_buffer;
if (stack_memory) {
xAudioTaskHandle = xTaskCreateStaticPinnedToCore(audio_task, "audio", 8192, NULL, 7, stack_memory, &task_buffer, 0);
}
#endif

xTaskCreatePinnedToCore(camera_task, "camera", 4096, NULL, 8, &xCameraTaskHandle, 1);

xTaskCreatePinnedToCore(peer_connection_task, "peer_connection", 8192, NULL, 5, &xPcTaskHandle, 1);

xTaskCreatePinnedToCore(peer_signaling_task, "peer_signaling", 8192, NULL, 6, &xPsTaskHandle, 1);

ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "open https://sepfy.github.io/webrtc?deviceId=%s", deviceid);

while (1) {
vTaskDelay(pdMS_TO_TICKS(1000));
peer_signaling_loop();
vTaskDelay(pdMS_TO_TICKS(10));
}
}
3 changes: 2 additions & 1 deletion examples/esp32/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8102
CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n
CONFIG_ESP_IPC_TASK_STACK_SIZE=2048
CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=16
Expand All @@ -26,3 +26,4 @@ CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744
CONFIG_LWIP_TCP_WND_DEFAULT=5744
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y
CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=8192
1 change: 1 addition & 0 deletions idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dependencies:
sepfy/srtp: ^2.0.4
sepfy/usrsctp: ^0.9.5
description: libpeer
license: MIT
url: https://github.com/sepfy/libpeer
Expand Down

0 comments on commit b9ad642

Please sign in to comment.