Skip to content

Commit 8d627a0

Browse files
committed
feat(mosq): Update brokerless example to work with esp-peer
1 parent e9b21ea commit 8d627a0

File tree

7 files changed

+403
-1
lines changed

7 files changed

+403
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
From a2d51a026449cf1ba2cb53996ce1cdf1f6f078d2 Mon Sep 17 00:00:00 2001
2+
From: David Cermak <cermak@espressif.com>
3+
Date: Wed, 9 Jul 2025 12:40:36 +0200
4+
Subject: [PATCH] fix(htt): Add default event to http-client handler
5+
6+
---
7+
components/esp_webrtc/impl/apprtc_signal/https_client.c | 2 ++
8+
1 file changed, 2 insertions(+)
9+
10+
diff --git a/components/esp_webrtc/impl/apprtc_signal/https_client.c b/components/esp_webrtc/impl/apprtc_signal/https_client.c
11+
index b7ee6fc..aca4a4e 100644
12+
--- a/components/esp_webrtc/impl/apprtc_signal/https_client.c
13+
+++ b/components/esp_webrtc/impl/apprtc_signal/https_client.c
14+
@@ -48,6 +48,8 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
15+
{
16+
http_info_t *info = evt->user_data;
17+
switch (evt->event_id) {
18+
+ default:
19+
+ break;
20+
case HTTP_EVENT_ERROR:
21+
ESP_LOGD(TAG, "HTTP_EVENT_ERROR");
22+
break;
23+
--
24+
2.25.1

components/mosquitto/examples/serverless_mqtt/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,16 @@
33
cmake_minimum_required(VERSION 3.16)
44

55
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
7+
execute_process(COMMAND ${CMAKE_BINARY_DIR}/../esp_peer_setup.sh
8+
${CMAKE_BINARY_DIR}
9+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
10+
RESULT_VARIABLE script_result)
11+
12+
if(script_result)
13+
message(FATAL_ERROR "Script esp_peer_setup.sh failed with exit code ${script_result}")
14+
endif()
15+
16+
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_BINARY_DIR}/esp-peer/components/")
17+
618
project(serverless_mqtt)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
From 06b15a30e860daef303b6c6541a2cae858c17e6c Mon Sep 17 00:00:00 2001
2+
From: David Cermak <cermak@espressif.com>
3+
Date: Thu, 10 Jul 2025 11:09:57 +0200
4+
Subject: [PATCH] fix(media_lib): Remove deprecated freeRTOS header
5+
6+
---
7+
components/media_lib_sal/port/media_lib_os_freertos.c | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/components/media_lib_sal/port/media_lib_os_freertos.c b/components/media_lib_sal/port/media_lib_os_freertos.c
11+
index d248d59..7b588ca 100644
12+
--- a/components/media_lib_sal/port/media_lib_os_freertos.c
13+
+++ b/components/media_lib_sal/port/media_lib_os_freertos.c
14+
@@ -40,7 +40,7 @@
15+
#include "esp_idf_version.h"
16+
17+
#if CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT
18+
-#include "freertos/task_snapshot.h"
19+
+#include "esp_private/freertos_debug.h"
20+
#endif
21+
22+
#ifdef __XTENSA__
23+
--
24+
2.43.0
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
echo "bin_dir: $1"
4+
5+
bin_dir="$1"
6+
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7+
ESP_PEER_VERSION="9512eef258a45aafcaaa309b1a67505c8b500363"
8+
9+
ESP_PEER_URL="https://github.com/espressif/esp-webrtc-solution/archive/${ESP_PEER_VERSION}.zip"
10+
ESP_PEER_DIR="${bin_dir}/esp-peer"
11+
ZIP_PATH="${bin_dir}/esp-peer.zip"
12+
EXTRACTED_DIR="${ESP_PEER_DIR}/esp-webrtc-solution-${ESP_PEER_VERSION}"
13+
COMPONENTS_SRC="${EXTRACTED_DIR}/components"
14+
COMPONENTS_DST="${ESP_PEER_DIR}/components"
15+
PATCH_FILE_1="${THIS_DIR}/Add-default-event-to-http-client-handler.patch"
16+
PATCH_FILE_2="${THIS_DIR}/Remove-deprecated-freeRTOS-header.patch"
17+
18+
# Download if not exists
19+
if [ ! -d "$EXTRACTED_DIR" ]; then
20+
echo "Downloading esp-peer ${ESP_PEER_VERSION}..."
21+
wget -O "$ZIP_PATH" "$ESP_PEER_URL"
22+
unzip -o "$ZIP_PATH" -d "$ESP_PEER_DIR"
23+
patch -p1 -d "$EXTRACTED_DIR" < "$PATCH_FILE_1"
24+
patch -p1 -d "$EXTRACTED_DIR" < "$PATCH_FILE_2"
25+
mv ${EXTRACTED_DIR}/components ${ESP_PEER_DIR}
26+
mv ${ESP_PEER_DIR}/components/esp_webrtc/impl/peer_default ${ESP_PEER_DIR}/components
27+
fi
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
idf_component_register(SRCS "serverless_mqtt.c"
22
"wifi_connect.c"
3+
"webrtc.c"
34
INCLUDE_DIRS "."
4-
REQUIRES libjuice nvs_flash mqtt json esp_wifi)
5+
REQUIRES libjuice nvs_flash mqtt json esp_wifi media_lib_sal esp_webrtc peer_default)

0 commit comments

Comments
 (0)