Skip to content

feat: Update RTSP so use new component API and have faster / more reliable streaming#15

Open
finger563 wants to merge 3 commits into
mainfrom
feat/updated-rtsp
Open

feat: Update RTSP so use new component API and have faster / more reliable streaming#15
finger563 wants to merge 3 commits into
mainfrom
feat/updated-rtsp

Conversation

@finger563

Copy link
Copy Markdown
Contributor
  • move to managed esp32 camera dep
  • feat: Update deps and update example to support higher throughput streaming by handling stream failures with backoff and setting static wifi buffers

Description

Motivation and Context

How has this been tested?

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

Hardware

  • I have updated the design files (schematic, board, libraries).
  • I have attached the PDFs of the SCH / BRD to this PR
  • I have updated the design output (GERBER, BOM) files.

finger563 added 2 commits June 7, 2026 17:27
…eaming by handling stream failures with backoff and setting static wifi buffers
Copilot AI review requested due to automatic review settings June 7, 2026 22:29
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

⚡ Static analysis result ⚡

🔴 cppcheck found 2 issues! Click here to see details.

#include "sdkconfig.h"
#include <chrono>
#include <freertos/FreeRTOS.h>

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

std::lock_guard<std::recursive_mutex> lock(server_mutex);
if (rtsp_server) {
capture_period = std::max(capture_period, rtsp_server->get_recommended_capture_period());
}
}
wait_until(start + capture_period);

!Line: 362 - style: Local variable 'lock' shadows outer variable [shadowVariable]

!Line: 352 - note: Shadowed declaration
!Line: 362 - note: Shadow variable

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the ESP-IDF camera-streamer example to use the newer managed esp32-camera component and adjusts the RTSP streaming loop and system configuration to improve throughput and resiliency.

Changes:

  • Migrates the camera dependency from a git submodule to a managed ESP-IDF component and updates the dependency lockfile.
  • Updates RTSP streaming behavior (session-aware capture pacing, backoff, and WiFi power-save disable) and adds heap/task monitoring hooks.
  • Tweaks default sdkconfig and partitions (PSRAM/WiFi/LWIP tuning; LittleFS partition subtype).

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sdkconfig.defaults Adds PSRAM/WiFi/LWIP tuning defaults and adjusts camera/I2C-related settings.
partitions.csv Switches the littlefs partition subtype from spiffs to littlefs.
main/main.cpp Updates RTSP server startup flow, capture pacing/backoff logic, and adds memory/task monitoring output.
main/idf_component.yml Moves to managed espressif/esp32-camera component dependency.
dependencies.lock Updates component versions/hashes and adds esp32-camera/esp_jpeg to the lock.
.gitmodules Removes the components/esp32-camera submodule entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread main/main.cpp
Comment on lines +303 to +315
{
std::lock_guard<std::recursive_mutex> lock(server_mutex);
if (!rtsp_server || !rtsp_server->has_active_sessions()) {
wait_until(start + idle_capture_poll_period);
return false;
}
auto recommended_capture_period = rtsp_server->get_recommended_capture_period();
auto capture_cooldown = rtsp_server->get_capture_cooldown();
if (capture_cooldown > 0ms) {
wait_until(start + std::max(recommended_capture_period, capture_cooldown));
return false;
}
}
Comment thread main/main.cpp
Comment on lines 351 to 355
std::span<const uint8_t> jpg_buf(_jpg_buf, _jpg_buf_len);
espp::JpegFrame image(jpg_buf);
std::lock_guard<std::recursive_mutex> lock(server_mutex);
rtsp_server->send_frame(image);
rtsp_server->send_frame(jpg_buf);
frames_streamed++;

Comment thread main/main.cpp
Comment on lines 346 to 349
if (!(_jpg_buf[_jpg_buf_len - 1] != 0xd9 || _jpg_buf[_jpg_buf_len - 2] != 0xd9)) {
esp_camera_fb_return(fb);
return false;
}
Comment thread sdkconfig.defaults
Comment on lines +41 to +43
#
# ESP32S3-specific
#
@github-actions

Copy link
Copy Markdown

ESP-IDF Size Report for 'Camera Streamer'

Metric Base PR Delta
FLASH 1,379,811 bytes (65.79%) 1,303,503 bytes (62.16%) ⬇️ -76,308 bytes (-3.63%)
DRAM 48,336 bytes (26.74%) 56,428 bytes (31.22%) 🔺 +8,092 bytes (+4.48%)
IRAM 121,827 bytes (92.95%) 121,587 bytes (92.76%) ⬇️ -240 bytes (-0.19%)
RAM (DRAM+IRAM) 170,163 bytes 178,015 bytes 🔺 +7,852 bytes (+2.52%)

FLASH uses app .bin size or json2 flash sum. RAM sums DRAM+IRAM via idf_size. Percentages shown when totals are available.
DRAM/IRAM usage does not include memory used by the heap allocator at runtime.
This report was generated by esp-idf-size-delta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants